diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2015-01-12 11:15:03 +0100 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2015-01-15 14:53:16 +0100 |
commit | 01252035cdc23ff64a593471e0272e7bbe9b1786 (patch) | |
tree | 2076af66e543401ef56630b9bb178d532926f4f7 | |
parent | d5c1e05a59c7c1ec4654710377920a51327b9c17 (diff) | |
download | fork-ledger-01252035cdc23ff64a593471e0272e7bbe9b1786.tar.gz fork-ledger-01252035cdc23ff64a593471e0272e7bbe9b1786.tar.bz2 fork-ledger-01252035cdc23ff64a593471e0272e7bbe9b1786.zip |
[doc] Add CheckTests to ctest
to check whether all available ledger options documented
and are being tested.
Signed-off-by: Alexis Hildebrandt <afh@surryhill.net>
-rw-r--r-- | doc/ledger.1 | 54 | ||||
-rw-r--r-- | doc/ledger3.texi | 537 | ||||
-rw-r--r-- | src/global.cc | 3 | ||||
-rw-r--r-- | src/global.h | 3 | ||||
-rw-r--r-- | test/CMakeLists.txt | 7 | ||||
-rwxr-xr-x | test/CheckTests.py | 205 | ||||
-rwxr-xr-x | test/GenerateTests.py | 4 | ||||
-rwxr-xr-x | test/RegressTests.py | 3 | ||||
-rw-r--r-- | test/baseline/opt-no-titles.test | 10 | ||||
-rw-r--r-- | test/baseline/opt-values.test | 6 |
10 files changed, 462 insertions, 370 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1 index 6995e2c8..3e4e66ad 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -50,7 +50,6 @@ Report in terms of cost basis, not amount or value. This is the only form of report which is guaranteed to always balance to zero, when no .Ar report-query is specified. -.It Fl \-collapse Pq Fl n Only show totals for the top-most accounts. .It Fl \-empty Pq Fl E Also show accounts whose total is zero. @@ -330,7 +329,8 @@ report. .It Fl \-anon Anonymize registry output, mostly for sending in bug reports. .It Fl \-args-only -.It Fl \-auto-match +Ignore init files and environment variables for the ledger run. +.\".It Fl \-auto-match .It Fl \-aux-date Show auxiliary dates for all calculations. Alias for @@ -342,7 +342,7 @@ running totals. Specify the format to use for the .Nm balance report. -.It Fl \-base +.\".It Fl \-base .It Fl \-basis Pq Fl B Report the cost basis on all posting. Alias for @@ -364,7 +364,7 @@ Specify the format to use for the report. .It Fl \-by-payee Pq Fl P Group postings in the register report by common payee names. -.It Fl \-cache Ar FILE +.\".It Fl \-cache Ar FILE .It Fl \-check-payees Enable strict and pedantic checking for payees as well as accounts, commodities and tags. @@ -419,7 +419,7 @@ Specify the format ledger should use to print dates. Specify the width, in characters, of the date column in the .Nm register report. -.It Fl \-day-break +.\".It Fl \-day-break .It Fl \-dc Display register or balance in debit/credit format If you use .Fl \-dc @@ -486,16 +486,17 @@ Related to the .Nm equity command. Gives current account balances in the form of a register report. -.It Fl \-exact +.\".It Fl \-exact .It Fl \-exchange Ar COMMODITY Oo , COMM, ... Oc Pq Fl X Display values in terms of the given .Ar COMMODITY . The latest available price is used. -.It Fl \-explicit +.\".It Fl \-explicit .It Fl \-file Ar FILE Read .Ar FILE as a ledger file. +.\".It Fl \-full-help .It Fl \-first Ar INT Print the first .Ar INT @@ -559,8 +560,12 @@ Alias for Print a summary of all the options, and what they are used for. This can be a handy way to remember which options do what. This help screen is also printed if ledger is run without a command. +.\".It Fl \-help-calc +.\".It Fl \-help-comm +.\".It Fl \-help-disp .It Fl \-immediate Instruct ledger to evaluate calculations immediately rather than lazily. +.\".It Fl \-import .It Fl \-init-file Ar FILE Causes .Nm FILE @@ -569,7 +574,11 @@ This file may not contain any postings, but it may contain option settings. To specify options in the init file, use the same syntax as the command-line, but put each option on its own line. .It Fl \-inject Ar STR -TODO +Use +.Ar STR +amounts in calculations. In case you know +what amount a transaction should be, but the actual transaction has the +wrong value you can use metadata STR to specify the expected amount. .It Fl \-input-date-format Ar DATEFMT Specify the input date format for journal entries. .It Fl \-invert @@ -597,7 +606,7 @@ purchased. .It Fl \-lots Report the date and price at which each commodity was purchased in a balance report. -.It Fl \-lots-actual +.\".It Fl \-lots-actual .It Fl \-market Pq Fl V Use the latest market value for all commodities. .It Fl \-master-account Ar STR @@ -617,6 +626,8 @@ Shorthand for Aliases are completely ignored. .It Fl \-no-color Suppress any color TTY output. +.\".It Fl \-no-pager +Suppress any color TTY output. .It Fl \-no-rounding Don't output .Nm <Rounding> @@ -672,7 +683,7 @@ For a balance report only those transactions will be accounted in the final balances. .It Fl \-period-sort Sort the posting within transactions using the given value expression. -.It Fl \-permissive +.\".It Fl \-permissive .It Fl \-pivot Ar STR Produce a balance pivot report .Nm around @@ -706,7 +717,11 @@ considered to be fresh enough. Alias for .Fl \-leeway Ar INT Pq Fl Z .It Fl \-prices-format Ar FMT +Set the format for the +.Nm prices +report. .It Fl \-pricedb-format Ar FMT +Set the format expected for the historical price file. .It Fl \-primary-date Show primary dates for all calculations. Alias for .Fl \-actual-dates @@ -742,10 +757,10 @@ Show all postings in a transaction, similar to but show .Nm both sides of each transaction. -.It Fl \-revalued -.It Fl \-revalued-only -.It Fl \-revalued-total Ar EXPR -.It Fl \-rich-data +.\".It Fl \-revalued +.\".It Fl \-revalued-only +.\".It Fl \-revalued-total Ar EXPR +.\".It Fl \-rich-data .It Fl \-seed Ar INT Set the random seed to .Ar INT @@ -756,7 +771,7 @@ command. Used as part of development testing. Execute a ledger script. .It Fl \-sort Ar EXPR Pq Fl S Sort the register report based on the value expression given to sort. -.It Fl \-sort-all +.\".It Fl \-sort-all .It Fl \-sort-xacts Sort the posting within transactions using the given value expression. .It Fl \-start-of-week Ar STR @@ -773,7 +788,10 @@ Report only the last .Ar INT entries. Only useful on a register report. Alias for .Fl \-last Ar INT -.It Fl \-time-report +.It Fl \-time-colon +Display the value for a seconds based commodity as real hours and minutes, +thus 8100 seconds will be displayed as 2:15h instead of 2.25h. +.\".It Fl \-time-report .It Fl \-total Ar EXPR Pq Fl T Define a value expression used to calculate the total in reports. .It Fl \-total-data Pq Fl J @@ -821,7 +839,7 @@ precision. Shows the values used by each tag when used in combination with the .Nm tags command. -.It Fl \-value-expr Ar EXPR +.\".It Fl \-value-expr Ar EXPR .It Fl \-verbose Print detailed information on the execution of Ledger. .It Fl \-verify @@ -829,7 +847,7 @@ Enable additional assertions during run-time. This causes a significant slowdown. When combined with .Fl \-debug Ar CODE ledger will produce memory trace information. -.It Fl \-verify-memory +.\".It Fl \-verify-memory .It Fl \-version Print version information and exit. .It Fl \-weekly Pq Fl W diff --git a/doc/ledger3.texi b/doc/ledger3.texi index c3b7571d..3404d7f9 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -5424,27 +5424,27 @@ Generate transactions based on previous postings. @ftable @code -@item --help +@item --help @c option @itemx -h Print summary of all options. -@item --version +@item --version @c option @itemx -v Print version information and exit. -@item --file @var{FILE} +@item --file @var{FILE} @c option @itemx -f @var{FILE} Read @file{FILE} as a ledger file. -@item --output @var{FILE} +@item --output @var{FILE} @c option @itemx -o @var{FILE} Redirect output to @file{FILE}. -@item --init-file @var{FILE} +@item --init-file @var{FILE} @c option @itemx -i @var{FILE} Specify an options file. -@item --account @var{STR} +@item --account @var{STR} @c option @itemx -a @var{STR} Specify default account @var{STR} for QIF file postings. @@ -5455,69 +5455,70 @@ Specify default account @var{STR} for QIF file postings. @ftable @code -@item --current +@item --current @c option @itemx -c Display only transactions on or before the current date. -@item --begin @var{DATE} +@item --begin @var{DATE} @c option @itemx -b @var{DATE} Limit the processing to transactions on or after @var{DATE}. -@item --end @var{DATE} +@item --end @var{DATE} @c option @itemx -e @var{DATE} Limit the processing to transactions before @var{DATE}. -@item --period @var{PERIOD_EXPRESSION} +@item --period @var{PERIOD_EXPRESSION} @c option @itemx -p @var{PERIOD_EXPRESSION} Limit the processing to transactions in @var{PERIOD_EXPRESSION}. -@item --period-sort @var{VEXPR} +@item --period-sort @var{VEXPR} @c option Sort postings within each period according to @var{VEXPR}. -@item --cleared +@item --cleared @c option @itemx -C Display only cleared postings. -@item --dc +@item --dc @c option Display register or balance in debit/credit format. -@item --uncleared +@item --uncleared @c option @itemx -U Display only uncleared postings. -@item --real +@item --real @c option @itemx -R Display only real postings. -@item --actual +@item --actual @c option @itemx -L Display only actual postings, not automated ones. -@item --related +@item --related @c option @itemx -r Display related postings. -@item --budget +@item --budget @c option Display how close your postings meet your budget. -@item --add-budget +@item --add-budget @c option Show unbudgeted postings. -@item --unbudgeted +@item --unbudgeted @c option Show only unbudgeted postings. -@item --forecast @var{VEXPR} +@item --forecast-while @var{VEXPR} @c option +@itemx --forecast @var{VEXPR} Project balances into the future. -@item --limit @var{EXPR} +@item --limit @var{EXPR} @c option @itemx -l @var{EXPR} Limit which postings are used in calculations by @var{EXPR}. -@item --amount @var{EXPR} +@item --amount @var{EXPR} @c option @itemx -t @var{EXPR} Change value expression reported in @command{register} report. -@item --total @var{VEXPR} +@item --total @var{VEXPR} @c option @itemx -T @var{VEXPR} Change the value expression used for ``totals'' column in @command{register} and @command{balance} reports. @@ -5529,19 +5530,19 @@ Change the value expression used for ``totals'' column in @ftable @code -@item --strict +@item --strict @c option Accounts, tags or commodities not previously declared will cause warnings. -@item --pedantic +@item --pedantic @c option Accounts, tags or commodities not previously declared will cause errors. -@item --check-payees +@item --check-payees @c option Enable strict and pedantic checking for payees as well as accounts, commodities and tags. This only works in conjunction with @option{--strict} or @option{--pedantic}. -@item --immediate +@item --immediate @c option Instruct ledger to evaluate calculations immediately rather than lazily. @end ftable @@ -5551,89 +5552,89 @@ Instruct ledger to evaluate calculations immediately rather than lazily. @ftable @code -@item --collapse +@item --collapse @c option @itemx -n Collapse transactions with multiple postings. -@item --subtotal +@item --subtotal @c option @itemx -s Report register as a single subtotal. -@item --by-payee +@item --by-payee @c option @itemx -P Report subtotals by payee. -@item --empty +@item --empty @c option @itemx -E Include empty accounts in the report. -@item --weekly +@item --weekly @c option @itemx -W Report posting totals by week. -@item --quarterly +@item --quarterly @c option Report posting totals by quarter. -@item --yearly +@item --yearly @c option @itemx -Y Report posting totals by year. -@item --dow +@item --dow @c option Report posting totals by day of week. -@item --sort @var{VEXPR} +@item --sort @var{VEXPR} @c option @itemx -S @var{VEXPR} Sort a report using @var{VEXPR}. -@item --wide +@item --wide @c option @itemx -w Assume 132 columns instead of 80. -@item --head @var{INT} +@item --head @var{INT} @c option Report the first @var{INT} postings. -@item --tail @var{INT} +@item --tail @var{INT} @c option Report the last @var{INT} postings. -@item --pager @var{FILE} +@item --pager @var{FILE} @c option Direct output to @var{FILE} pager program. -@item --average +@item --average @c option @itemx -A Report the average posting value. -@item --deviation +@item --deviation @c option @itemx -D Report each posting's deviation from the average. -@item --percent +@item --percent @c option @itemx -% Show subtotals in the balance report as percentages. @c @item --totals @c Include running total in the @command{xml} report -@item --pivot @var{TAG} +@item --pivot @var{TAG} @c option Produce a pivot table of the @var{TAG} type specified. -@item --amount-data +@item --amount-data @c option @itemx -j Show only the date and value columns to format the output for plots. -@item --plot-amount-format @var{FORMAT_STRING} +@item --plot-amount-format @var{FORMAT_STRING} @c option Specify the format for the plot output. -@item --total-data +@item --total-data @c option @itemx -J Show only the date and total columns to format the output for plots. -@item --plot-total-format @var{FORMAT_STRING} +@item --plot-total-format @var{FORMAT_STRING} @c option Specify the format for the plot output. -@item --display @var{EXPR} +@item --display @var{EXPR} @c option @itemx -d @var{EXPR} Display only postings that meet the criteria in the @var{EXPR}. -@item --date-format @var{DATE_FORMAT} +@item --date-format @var{DATE_FORMAT} @c option @itemx -y @var{DATE_FORMAT} Change the basic date format used in reports. @@ -5644,7 +5645,7 @@ Change the basic date format used in reports. @itemx -F @var{FORMAT_STRING} Set the reporting format for various reports. -@item --anon +@item --anon @c option Print the ledger register with anonymized accounts and payees, useful for filing bug reports. @@ -5655,33 +5656,33 @@ for filing bug reports. @ftable @code -@item --by-payee +@item --by-payee @c option @itemx -P Group postings by common payee names. -@item --daily +@item --daily @c option @itemx -D Group postings by day. -@item --weekly +@item --weekly @c option @itemx -W Group postings by week. -@item --monthly +@item --monthly @c option @itemx -M Group postings by month. -@item --quarterly +@item --quarterly @c option Group postings by quarter. -@item --yearly +@item --yearly @c option @itemx -Y Group postings by year. -@item --dow +@item --dow @c option Group by day of weeks. -@item --subtotal +@item --subtotal @c option @itemx -s Group postings together, similar to the balance report. @@ -5692,33 +5693,33 @@ Group postings together, similar to the balance report. @ftable @code -@item --price-db @var{FILE} +@item --price-db @var{FILE} @c option Use @file{FILE} for retrieving stored commodity prices. -@item --price-exp @var{INT} +@item --price-exp @var{INT} @c option @itemx -Z @var{INT} Set expected freshness of prices in @var{INT} minutes. -@item --download +@item --download @c option @itemx -Q Download quotes using the script named @file{getquote}. -@item --getquote @var{FILE} +@item --getquote @var{FILE} @c option Sets the path to a user-defined script to download commodity prices. -@item --quantity +@item --quantity @c option @itemx -O Report commodity totals without conversion. -@item --basis +@item --basis @c option @itemx -B Report cost basis. -@item --market +@item --market @c option @itemx -V Report last known market value. -@item --gain +@item --gain @c option @itemx -G Report net gain or loss for commodities that have a price history. @@ -5750,23 +5751,23 @@ sessions with multiple reports per session. @ftable @code -@item --args-only +@item --args-only @c option Ignore all environment and init-file settings and use only command-line arguments to control Ledger. Useful for debugging or testing small journal files not associated with your main financial database. -@item --debug @var{CODE} +@item --debug @var{CODE} @c option FIX THIS ENTRY @c FIXME thdox -@item --help +@item --help @c option @itemx -h Display the man page for ledger. -@item --init-file @var{FILE} +@item --init-file @var{FILE} @c option Specify the location of the init file. The default is @file{~/.ledgerrc}. -@item --options +@item --options @c option Display the options in effect for this Ledger invocation, along with their values and the source of those values, for example: @@ -5802,18 +5803,20 @@ with a @samp{$}, the source was an environment variable. If the source is @code{?normalize} the value was set internally by ledger, in a function called @code{normalize_options}. -@item --script @var{FILE} +@item --script @var{FILE} @c option Execute a ledger script. -@item --trace @var{INT} -FIX THIS ENTRY @c FIXME thdox +@item --trace @var{INT} @c option +Enable tracing. The @var{INT} specifies the level of trace desired. -@item --verbose +@item --verbose @c option @itemx -v -FIX THIS ENTRY @c FIXME thdox +Print detailed information on the execution of Ledger. -@item --verify -FIX THIS ENTRY @c FIXME thdox +@item --verify @c option +Enable additional assertions during run-time. This causes a significant +slowdown. When combined with @option{--debug @var{CODE}} ledger will +produce memory trace information. @item --verify-memory FIX THIS ENTRY @c FIXME thdox @@ -5844,29 +5847,29 @@ FIX THIS ENTRY @c FIXME thdox @item --day-break FIX THIS ENTRY @c FIXME thdox -@item --decimal-comma +@item --decimal-comma @c option Direct Ledger to parse journals using the European standard comma as a decimal separator, not the usual period. -@item --download +@item --download @c option @itemx -Q Direct Ledger to download prices using the script defined via the option @option{--getquote @var{FILE}}. -@item --explicit +@item --explicit @c option FIX THIS ENTRY @c FIXME thdox -@item --file @var{FILE} +@item --file @var{FILE} @c option @itemx -f @var{FILE} Specify the input @file{FILE} for this invocation. -@item --getquote @var{FILE} +@item --getquote @var{FILE} @c option @cindex getquote @cindex download prices Tell ledger where to find the user defined script to download prices information. -@item --input-date-format @var{DATE_FORMAT} +@item --input-date-format @var{DATE_FORMAT} @c option Specify the input date format for journal entries. For example, @smallexample @@ -5877,7 +5880,7 @@ Would convert the @file{Export.csv} file to ledger format, assuming the dates in the CSV file are like 12/23/2009 (@pxref{Date and Time Format Codes}). -@item --master-account @var{STR} +@item --master-account @var{STR} @c option Prepend all account names with the argument. @smallexample @c command:A76BB56 @@ -5905,19 +5908,19 @@ $ ledger -f drewr3.dat bal --no-total --master-account HUMBUG $ 200.00 Mortgage:Principal @end smallexample -@item --no-aliases +@item --no-aliases @c option Ledger does not expand any aliases if this option is specified. -@item --pedantic +@item --pedantic @c option Accounts, tags or commodities not previously declared will cause errors. @item --permissive FIX THIS ENTRY @c FIXME thdox -@item --price-db @var{FILE} +@item --price-db @var{FILE} @c option Specify the location of the price entry data file. -@item --price-exp @var{INT} +@item --price-exp @var{INT} @c option @itemx -Z @var{INT} @itemx --leeway @var{INT} Set the expected freshness of price quotes, in @var{INT} minutes. That @@ -5926,7 +5929,7 @@ and if @option{--download} is being used, then the Internet will be consulted again for a newer price. Otherwise, the old price is still considered to be fresh enough. -@item --strict +@item --strict @c option Ledger normally silently accepts any account or commodity in a posting, even if you have misspelled a commonly used one. The option @option{--strict} changes that behavior. While running with @@ -5935,12 +5938,12 @@ correct, and if it encounters a new account or commodity (same as a misspelled commodity or account) it will issue a warning giving you the file and line number of the problem. -@item --recursive-aliases +@item --recursive-aliases @c option Normally, ledger only expands aliases once. With this option, ledger tries to expand the result of alias expansion recursively, until no more expansions apply. -@item --time-colon +@item --time-colon @c option The @option{--time-colon} option will display the value for a seconds based commodity as real hours and minutes. @@ -5964,7 +5967,7 @@ sessions with multiple reports per session. @ftable @code -@item --abbrev-len @var{INT} +@item --abbrev-len @var{INT} @c option Set the minimum length an account can be abbreviated to if it doesn't fit inside the @code{account-width}. If @var{INT} is zero, then the account name will be truncated on the right. If @var{INT} is greater @@ -5972,54 +5975,54 @@ than @code{account-width} then the account will be truncated on the left, with no shortening of the account names in order to fit into the desired width. -@item --account @var{STR} +@item --account @var{STR} @c option Prepend @var{STR} to all accounts reported. That is, the option @samp{--account Personal} would tack @samp{Personal:} to the beginning of every account reported in a balance report or register report. -@item --account-width @var{INT} +@item --account-width @var{INT} @c option Set the width of the account column in the @command{register} report to @var{INT} characters. -@item --actual +@item --actual @c option @itemx -L Report only real transactions, ignoring all automated or virtual transactions. -@item --add-budget +@item --add-budget @c option Show only unbudgeted postings. -@item --amount @var{EXPR} +@item --amount @var{EXPR} @c option @itemx -t @var{EXPR} Apply the given value expression to the posting amount (@pxref{Value Expressions}). Using @option{--amount @var{EXPR}} you can apply an arbitrary transformation to the postings. -@item --amount-data +@item --amount-data @c option @itemx -j On a register report print only the date and amount of postings. Useful for graphing and spreadsheet applications. -@item --amount-width @var{INT} +@item --amount-width @var{INT} @c option Set the width in characters of the amount column in the @command{register} report. -@item --anon +@item --anon @c option Anonymize registry output, mostly for sending in bug reports. @item --auto-match FIX THIS ENTRY @c FIXME thdox -@item --aux-date +@item --aux-date @c option @itemx --effective Show auxiliary dates for all calculations (@pxref{Effective Dates}). -@item --average +@item --average @c option @itemx -A Print average values over the number of transactions instead of running totals. -@item --balance-format @var{FORMAT_STRING} +@item --balance-format @var{FORMAT_STRING} @c option Specify the format to use for the @command{balance} report (@pxref{Format Strings}). The default is: @@ -6034,16 +6037,16 @@ Strings}). The default is: @item --base FIX THIS ENTRY @c ASK JOHN -@item --basis +@item --basis @c option @itemx -B @itemx --cost Report the cost basis on all posting. -@item --begin @var{DATE} +@item --begin @var{DATE} @c option Specify the start @var{DATE} of all calculations. Transactions before that date will be ignored. -@item --bold-if @var{VEXPR} +@item --bold-if @var{VEXPR} @c option Print the entire line in bold if the given value expression is true (@pxref{Value Expressions}). @@ -6060,7 +6063,7 @@ Only display budgeted items. In a register report this displays transactions in the budget, in a balance report this displays accounts in the budget (@pxref{Budgeting and Forecasting}). -@item --budget-format @var{FORMAT_STRING} +@item --budget-format @var{FORMAT_STRING} @c option Specify the format to use for the @command{budget} report (@pxref{Format Strings}). The default is: @@ -6072,16 +6075,16 @@ Strings}). The default is: "--------------------\n" @end smallexample -@item --by-payee +@item --by-payee @c option @itemx -P Group the register report by payee. -@item --cleared +@item --cleared @c option @itemx -C Consider only transactions that have been cleared for display and calculation. -@item --cleared-format @var{FORMAT_STRING} +@item --cleared-format @var{FORMAT_STRING} @c option FIX THIS ENTRY @c FIXME thdox: to keep? Specify the format to use for the @command{cleared} report (@pxref{Format Strings}). The default is: @@ -6098,26 +6101,26 @@ Strings}). The default is: "---------------- ---------------- ---------\n" @end smallexample -@item --collapse +@item --collapse @c option @itemx -n By default ledger prints all accounts in an account tree. With @option{--collapse} it prints only the top level account specified. -@item --collapse-if-zero +@item --collapse-if-zero @c option Collapse the account display only if it has a zero balance. -@item --color +@item --color @c option @itemx --ansi Use color if the terminal supports it. -@item --columns @var{INT} +@item --columns @var{INT} @c option Specify the width of the @command{register} report in characters. -@item --count +@item --count @c option Direct ledger to report the number of items when appended to the @command{commodities}, @command{accounts} or @command{payees} command. -@item --csv-format @var{FORMAT_STRING} +@item --csv-format @var{FORMAT_STRING} @c option Specify the format to use for the @command{csv} report (@pxref{Format Strings}). The default is: @@ -6132,29 +6135,29 @@ Strings}). The default is: "%(quoted(join(note | xact.note)))\n" @end smallexample -@item --current +@item --current @c option Shorthand for @samp{--limit "date <= today"}. -@item --daily +@item --daily @c option @itemx -D Shorthand for @samp{--period "daily"}. -@item --date @var{EXPR} +@item --date @var{EXPR} @c option Transform the date of the transaction using @var{EXPR}. -@item --date-format @var{DATE_FORMAT} +@item --date-format @var{DATE_FORMAT} @c option @itemx -y @var{DATE_FORMAT} Specify the format ledger should use to read and print dates (@pxref{Date and Time Format Codes}). -@item --date-width @var{INT} +@item --date-width @var{INT} @c option Specify the width, in characters, of the date column in the @command{register} report. @item --datetime-format @var{FIXME} FIX THIS ENTRY @c ASK JOHN -@item --dc +@item --dc @c option Display register or balance in debit/credit format If you use @option{--dc} with either the @command{register} (reg) or @command{balance} (bal) commands, you will now get extra columns. @@ -6213,29 +6216,29 @@ And with @option{--dc} it becomes this: $145 $145 0 @end smallexample -@item --depth @var{INT} +@item --depth @var{INT} @c option Limit the depth of the account tree. In a balance report, for example, a @samp{--depth 2} statement will print balances only for accounts with two levels, i.e. @samp{Expenses:Entertainment} but not @samp{Expenses:Entertainment:Dining}. This is a display predicate, which means it only affects display, not the total calculations. -@item --deviation +@item --deviation @c option Report each posting’s deviation from the average. It is only meaningful in the register and prices reports. -@item --display @var{EXPR} +@item --display @var{EXPR} @c option Display only lines that satisfy the expression @var{EXPR}. -@item --display-amount @var{EXPR} +@item --display-amount @var{EXPR} @c option Apply a transformation to the @emph{displayed} amount. This happens after calculations occur. -@item --display-total @var{EXPR} +@item --display-total @var{EXPR} @c option Apply a transformation to the @emph{displayed} total. This happens after calculations occur. -@item --dow +@item --dow @c option @itemx --days-of-week Group transactions by the day of the week. @@ -6246,15 +6249,15 @@ $ ledger reg Expenses --dow --collapse @noindent Will print all Expenses totaled for each day of the week. -@item --empty +@item --empty @c option @itemx -E Include empty accounts in the report and in average calculations. -@item --end @var{DATE} +@item --end @var{DATE} @c option Specify the end @var{DATE} for a transaction to be considered in the report. All transactions on or after this date are ignored. -@item --equity +@item --equity @c option Related to the @command{equity} command (@pxref{The @command{equity} command}). Gives current account balances in the form of a register report. @@ -6262,7 +6265,7 @@ report. @item --exact FIX THIS ENTRY @c ASK JOHN -@item --exchange @var{COMMODITY} +@item --exchange @var{COMMODITY} @c option @itemx -X @var{COMMODITY} Display values in terms of the given @var{COMMODITY}. The latest available price is used. The syntax @@ -6276,44 +6279,44 @@ which is particularly useful for situations where many prices are available for reporting in terms of @var{COMMODITY2}, but only a few should be displayed that way. -@item --flat +@item --flat @c option Force the full names of accounts to be used in the balance report. The balance report will not use an indented tree. -@item --force-color +@item --force-color @c option Output TTY color codes even if the TTY doesn't support them. Useful for TTYs that don't advertise their capabilities correctly. -@item --force-pager +@item --force-pager @c option Force Ledger to paginate its output. -@item --forecast-while @var{VEXPR} +@item --forecast-while @var{VEXPR} @c option @itemx --forecast @var{VEXPR} Continue forecasting while @var{VEXPR} is true. -@item --forecast-years @var{INT} +@item --forecast-years @var{INT} @c option Forecast at most @var{INT} years into the future. -@item --format @var{FORMAT_STRING} +@item --format @var{FORMAT_STRING} @c option @itemx -F @var{FORMAT_STRING} Use the given format string to print output. -@item --gain +@item --gain @c option @itemx -G @itemx --change Report on gains using the latest available prices. -@item --generated +@item --generated @c option Include auto-generated postings (such as those from automated transactions) in the report, in cases where you normally wouldn't want them. -@item --group-by @var{EXPR} +@item --group-by @var{EXPR} @c option Group transactions together in the @command{register} report. @var{EXPR} can be anything, although most common would be @code{payee} or @code{commodity}. The @code{tags()} function is also useful here. -@item --group-title-format @var{FORMAT_STRING} +@item --group-title-format @var{FORMAT_STRING} @c option Set the format for the headers that separates the report sections of a grouped report. Only has an effect with a @option{--group-by @var{EXPR}} register report. @@ -6331,19 +6334,19 @@ $ ledger reg Expenses --group-by "payee" --group-title-format "----------------- ... @end smallexample -@item --head @var{INT} +@item --head @var{INT} @c option @itemx --first @var{INT} Print the first @var{INT} entries. Opposite of @option{--tail @var{INT}}. -@item --historical +@item --historical @c option @itemx -H FIX THIS ENTRY @c FIXME thdox -@item --immediate +@item --immediate @c option FIX THIS ENTRY @c FIXME thdox -@item --inject +@item --inject @c option Use @code{Expected} amounts in calculations. In case you know what amount a transaction should be, but the actual transaction has the wrong value you can use metadata to specify the expected amount: @@ -6357,105 +6360,105 @@ wrong value you can use metadata to specify the expected amount: Then using the command @code{ledger reg --inject=Expected Income} would treat the transaction as if the ``Expected Value'' was actual. -@item --invert +@item --invert @c option Change the sign of all reported values. -@item --limit @var{EXPR} +@item --limit @var{EXPR} @c option @itemx -l @var{EXPR} Only transactions that satisfy @var{EXPR} are considered in calculations and for display. -@item --lot-dates +@item --lot-dates @c option Report the date on which each commodity in a balance report was purchased. -@item --lot-notes +@item --lot-notes @c option @itemx --lot-tags Report the tag attached to each commodity in a balance report. -@item --lot-prices +@item --lot-prices @c option Report the price at which each commodity in a balance report was purchased. -@item --lots +@item --lots @c option Report the date and price at which each commodity was purchased in a balance report. @item --lots-actual FIX THIS ENTRY -@item --market +@item --market @c option @itemx -V Use the latest market value for all commodities. -@item --meta @var{TAG} +@item --meta @var{TAG} @c option In the register report, prepend the transaction with the value of the given @var{TAG}. -@item --meta-width @var{INT} +@item --meta-width @var{INT} @c option Specify the width of the Meta column used for the @option{--meta @var{TAG}} options. -@item --monthly +@item --monthly @c option @itemx -M Synonym for @samp{--period "monthly"}. -@item --no-aliases +@item --no-aliases @c option Aliases are completely ignored. -@item --no-color +@item --no-color @c option Suppress any color TTY output. -@item --no-rounding +@item --no-rounding @c option Don't output @samp{<Rounding>} postings. Note that this will cause the running total to often not add up! Its main use is for @option{--amount-data (-j)} and @option{--total-data (-J)} reports. -@item --no-titles +@item --no-titles @c option Suppress the output of group titles. -@item --no-total +@item --no-total @c option Suppress printing the final total line in a balance report. -@item --now @var{DATE} +@item --now @var{DATE} @c option Define the current date in case you want to calculate in the past or future using @option{--current}. -@item --only @var{FIXME} +@item --only @var{FIXME} @c option This is a postings predicate that applies after certain transforms have been executed, such as periodic gathering. -@item --output @var{FILE} +@item --output @var{FILE} @c option Redirect the output of ledger to the file defined in @file{FILE}. -@item --pager @var{FILE} +@item --pager @var{FILE} @c option Specify the pager program to use. -@item --payee @var{VEXPR} +@item --payee @var{VEXPR} @c option Sets a value expression for formatting the payee. In the @command{register} report this prevents the second entry from having a date and payee for each transaction. -@item --payee-width @var{INT} +@item --payee-width @var{INT} @c option Set the number of columns dedicated to the payee in the register report to @var{INT}. -@item --pending +@item --pending @c option Use only postings that are marked pending. -@item --percent +@item --percent @c option @itemx -% Calculate the percentage value of each account in balance reports. Only works for accounts that have a single commodity. -@item --period @var{PERIOD_EXPRESSION} +@item --period @var{PERIOD_EXPRESSION} @c option Define a period expression that sets the time period during which transactions are to be accounted. For a @command{register} report only the transactions that satisfy the period expression with be displayed. For a @command{balance} report only those transactions will be accounted in the final balances. -@item --pivot @var{TAG} +@item --pivot @var{TAG} @c option Produce a balance pivot report @emph{around} the given @var{TAG}. For example, if you have multiple cars and track each fuel purchase in @samp{Expenses:Auto:Fuel} and tag each fuel purchase with a tag @@ -6476,60 +6479,60 @@ $ ledger bal Fuel --pivot "Car" --period "this year" @xref{Metadata values}. -@item --plot-amount-format @var{FORMAT_STRING} +@item --plot-amount-format @var{FORMAT_STRING} @c option Define the output format for an amount data plot. @xref{Visualizing with Gnuplot}. -@item --plot-total-format @var{FORMAT_STRING} +@item --plot-total-format @var{FORMAT_STRING} @c option Define the output format for a total data plot. @xref{Visualizing with Gnuplot}. -@item --prepend-format @var{FORMAT_STRING} +@item --prepend-format @var{FORMAT_STRING} @c option Prepend @var{STR} to every line of the output. -@item --prepend-width @var{INT} +@item --prepend-width @var{INT} @c option Reserve @var{INT} spaces at the beginning of each line of the output. -@item --price +@item --price @c option @itemx -I Use the price of the commodity purchase for performing calculations. -@item --pricedb-format @var{FORMAT_STRING} -FIX THIS ENTRY @c FIXME thdox +@item --pricedb-format @var{FORMAT_STRING} @c option +Set the format expected for the historical price file. @item --prices-format @var{FORMAT_STRING} -FIX THIS ENTRY @c FIXME thdox +Set the format for the @command{prices} report. -@item --primary-date +@item --primary-date @c option @itemx --actual-dates Show primary dates for all calculations (@pxref{Effective Dates}). -@item --quantity +@item --quantity @c option @itemx -O Report commodity totals (this is the default). -@item --quarterly +@item --quarterly @c option Synonym for @samp{--period "quarterly"}. -@item --raw +@item --raw @c option In the @command{print} report, show transactions using the exact same syntax as specified by the user in their data file. Don't do any massaging or interpreting. This can be useful for minor cleanups, like just aligning amounts. -@item --real +@item --real @c option @itemx -R Account using only real transactions ignoring virtual and automatic transactions. -@item --register-format @var{FORMAT_STRING} +@item --register-format @var{FORMAT_STRING} @c option Define the output format for the @command{register} report. -@item --related +@item --related @c option In a @command{register} report show the related account. This is the other @emph{side} of the transaction. -@item --related-all +@item --related-all @c option Show all postings in a transaction, similar to @option{--related} but show both @emph{sides} of each transaction. @@ -6546,23 +6549,23 @@ FIX THIS ENTRY @itemx --detail FIX THIS ENTRY @c FIXME thdox -@item --seed @var{FIXME} +@item --seed @var{FIXME} @c option Set the random seed to @var{FIXME} for the @code{generate} command. Used as part of development testing. -@item --sort @var{VEXPR} +@item --sort @var{VEXPR} @c option @itemx -S @var{VEXPR} Sort the @command{register} report based on the value expression given to sort. -@item --sort-all @var{FIXME} -FIX THIS ENTRY +@c @item --sort-all @var{FIXME} +@c FIX THIS ENTRY -@item --sort-xacts @var{VEXPR} +@item --sort-xacts @var{VEXPR} @c option @itemx --period-sort @var{VEXPR} Sort the postings within transactions using the given value expression. -@item --start-of-week @var{INT} +@item --start-of-week @var{INT} @c option Tell ledger to use a particular day of the week to start its ``weekly'' summary. @samp{--start-of-week=1} specifies Monday as the start of the week. @@ -6571,7 +6574,7 @@ week. @itemx -s FIX THIS ENTRY -@item --tail @var{INT} +@item --tail @var{INT} @c option @itemx --last @var{INT} Report only the last @var{INT} entries. Only useful in a @command{register} report. @@ -6579,62 +6582,62 @@ a @command{register} report. @item --time-report FIX THIS ENTRY @c FIXME thdox -@item --total @var{VEXPR} +@item --total @var{VEXPR} @c option @itemx -T @var{VEXPR} Define a value expression used to calculate the total in reports. -@item --total-data +@item --total-data @c option @itemx -J Show only dates and totals to format the output for plots. -@item --total-width @var{INT} +@item --total-width @var{INT} @c option Set the width of the total field in the register report. -@item --truncate @var{CODE} +@item --truncate @var{CODE} @c option Indicates how truncation should happen when the contents of columns exceed their width. Valid arguments are @samp{leading}, @samp{middle}, and @samp{trailing}. The default is smarter than any of these three, as it considers sub-names within the account name (that style is called ``abbreviate''). -@item --unbudgeted +@item --unbudgeted @c option Show only unbudgeted postings. -@item --uncleared +@item --uncleared @c option @itemx -U Use only uncleared transactions in calculations and reports. -@item --unrealized +@item --unrealized @c option Show generated unrealized gain and loss accounts in the balance report. -@item --unrealized-gains @var{STR} +@item --unrealized-gains @var{STR} @c option Allow the user to specify what account name should be used for unrealized gains. Defaults to @samp{"Equity:Unrealized Gains"}. Often set in one's @file{~/.ledgerrc} file to change the default. -@item --unrealized-losses @var{STR} +@item --unrealized-losses @var{STR} @c option Allow the user to specify what account name should be used for unrealized gains. Defaults to @samp{"Equity:Unrealized Losses"}. Often set in one's @file{~/.ledgerrc} file to change the default. -@item --unround +@item --unround @c option Perform all calculations without rounding and display results to full precision. -@item --values +@item --values @c option Shows the values used by each tag when used in combination with the @command{tags} command. -@item --weekly +@item --weekly @c option @itemx -W Synonym for @samp{--period "weekly"}. -@item --wide +@item --wide @c option Let the register report use 132 columns instead of 80 (the default). Identical to @samp{--columns "132"}. -@item --yearly +@item --yearly @c option @itemx -Y Synonym for @samp{--period "yearly"}. @@ -6649,29 +6652,29 @@ variables}), instead of using actual command-line options: @ftable @code -@item --help +@item --help @c option @itemx -h Print a summary of all the options, and what they are used for. This can be a handy way to remember which options do what. -@item --version +@item --version @c option Print the current version of ledger and exits. This is useful for sending bug reports, to let the author know which version of ledger you are using. -@item --file @var{FILE} +@item --file @var{FILE} @c option @itemx -f @var{FILE} Read @file{FILE} as a ledger file. @var{FILE} can be @samp{-} which is a synonym for @samp{/dev/stdin}. This command may be used multiple times. Typically, the environment variable @env{LEDGER_FILE} is set, rather than using this command-line option. -@item --output @var{FILE} +@item --output @var{FILE} @c option @itemx -o @var{FILE} Redirect output from any command to @file{FILE}. By default, all output goes to standard output. -@item --init-file @var{FILE} +@item --init-file @var{FILE} @c option @itemx -i @var{FILE} Causes @file{FILE} to be read by ledger before any other ledger file. This file may not contain any postings, but it may contain option @@ -6688,7 +6691,7 @@ example init file: Option settings on the command-line or in the environment always take precedence over settings in the init file. -@item --account @var{STR} +@item --account @var{STR} @c option @itemx -a @var{STR} Specify the default account which QIF file postings are assumed to relate to. @@ -6703,11 +6706,11 @@ report, in ways other than just using regular expressions: @ftable @code -@item --current +@item --current @c option @itemx -c Display only transactions occurring on or before the current date. -@item --begin @var{DATE} +@item --begin @var{DATE} @c option @itemx -b @var{DATE} Constrain the report to transactions on or after @var{DATE}. Only transactions after that date will be calculated, which means that the @@ -6715,12 +6718,12 @@ running total in the balance report will always start at zero with the first matching transaction. (Note: This is different from using @option{--display @var{EXPR}} to constrain what is displayed). -@item --end @var{DATE} +@item --end @var{DATE} @c option @itemx -e @var{DATE} Constrain the report so that transactions on or after @var{DATE} are not considered. -@item --period @var{PERIOD_EXPRESSION} +@item --period @var{PERIOD_EXPRESSION} @c option @itemx -p @var{PERIOD_EXPRESSION} Set the reporting period to @var{STR}. This will subtotal all matching transactions within each period separately, making it easy to see @@ -6729,7 +6732,7 @@ even specify the beginning and end of the report range, using simple terms like @samp{last June} or @samp{next month}. For more details on period expressions, see @ref{Period Expressions}. -@item --period-sort @var{VEXPR} +@item --period-sort @var{VEXPR} @c option Sort the postings within each reporting period using the value expression @var{EXPR}. This is most often useful when reporting monthly expenses, in order to view the highest expense categories at @@ -6740,28 +6743,28 @@ the top of each month: $ ledger -M --period-sort total reg ^Expenses @end smallexample -@item --cleared +@item --cleared @c option @itemx -C Display only postings whose transaction has been marked ``cleared'' (by placing an asterisk to the right of the date). -@item --uncleared +@item --uncleared @c option @itemx -U Display only postings whose transaction has not been marked ``cleared'' (i.e., if there is no asterisk to the right of the date). -@item --real +@item --real @c option @itemx -R Display only real postings, not virtual. (A virtual posting is indicated by surrounding the account name with parentheses or brackets; see @ref{Virtual postings} for more information). -@item --actual +@item --actual @c option @itemx -L Display only actual postings, and not those created by automated transactions. -@item --related +@item --related @c option @itemx -r Display postings that are related to whichever postings would otherwise have matched the filtering criteria. In the register @@ -6791,25 +6794,25 @@ posting that matched: Assets:Checking $-85.00 $-65.00 @end smallexample -@item --budget +@item --budget @c option Useful for displaying how close your postings meet your budget. @option{--add-budget} also shows unbudgeted postings, while @option{--unbudgeted} shows only those. @option{--forecast @var{VEXPR}} is a related option that projects your budget into the future, showing how it will affect future balances. @xref{Budgeting and Forecasting}. -@item --limit @var{EXPR} +@item --limit @var{EXPR} @c option @itemx -l @var{EXPR} Limit which postings take part in the calculations of a report. -@item --amount @var{EXPR} +@item --amount @var{EXPR} @c option @itemx -t @var{EXPR} Change the value expression used to calculate the ``value'' column in the @command{register} report, the amount used to calculate account totals in the @command{balance} report, and the values printed in the @command{equity} report. @xref{Value Expressions}. -@item --total @var{VEXPR} +@item --total @var{VEXPR} @c option @itemx -T @var{VEXPR} Set the value expression used for the ``totals'' column in the @command{register} and @command{balance} reports. @@ -6868,48 +6871,48 @@ used to create it: @ftable @code -@item --collapse +@item --collapse @c option @itemx -n Cause transactions in a @command{register} report with multiple postings to be collapsed into a single, subtotaled transaction. -@item --subtotal +@item --subtotal @c option @itemx -s Cause all transactions in a @command{register} report to be collapsed into a single, subtotaled transaction. -@item --by-payee +@item --by-payee @c option @itemx -P Report subtotals by payee. -@item --empty +@item --empty @c option @itemx -E Include even empty accounts in the @command{balance} report. -@item --weekly +@item --weekly @c option @itemx -W Report posting totals by the week. The week begins on whichever day of the week begins the month containing that posting. To set a specific begin date, use a period string, such as @samp{weekly from DATE}. -@item --monthly +@item --monthly @c option @itemx -M Report posting totals by month. -@item --yearly +@item --yearly @c option @itemx -Y Report posting totals by year. For more complex periods, use @option{--period}. @c TODO end this sentence -@item --period @var{PERIOD_EXPRESSION} +@item --period @var{PERIOD_EXPRESSION} @c option Option described above. -@item --dow +@item --dow @c option Report posting totals for each day of the week. This is an easy way to see if weekend spending is more than on weekdays. -@item --sort @var{VEXPR} +@item --sort @var{VEXPR} @c option @itemx -S @var{VEXPR} Sort a report by comparing the values determined using the value expression @var{VEXPR}. For example, using @samp{-S "-abs(total)"} in @@ -6917,16 +6920,16 @@ the @command{balance} report will sort account balances from greatest to least, using the absolute value of the total. For more on how to use value expressions, see @ref{Value Expressions}. -@item --pivot @var{TAG} +@item --pivot @var{TAG} @c option Produce a pivot table around the @var{TAG} provided. This requires meta data using valued tags. -@item --wide +@item --wide @c option @itemx -w Cause the default @command{register} report to assume 132 columns instead of 80. -@item --head @var{INT} +@item --head @var{INT} @c option Cause only the first @var{INT} transactions to be printed. This is different from using the command-line utility @file{head}, which would limit to the first @var{INT} postings. @option{--tail @var{INT}} outputs @@ -6935,21 +6938,21 @@ simultaneously. If a negative amount is given, it will invert the meaning of the flag (instead of the first five transactions being printed, for example, it would print all but the first five). -@item --pager @var{FILE} +@item --pager @var{FILE} @c option Tell Ledger to pass its output to the given pager program; very useful when the output is especially long. This behavior can be made the default by setting the @env{LEDGER_PAGER} environment variable. -@item --average +@item --average @c option @itemx -A Report the average posting value. -@item --deviation +@item --deviation @c option @itemx -D Report each posting's deviation from the average. It is only meaningful in the @command{register} and @command{prices} reports. -@item --percent +@item --percent @c option @itemx -% Show account subtotals in the @command{balance} report as percentages of the parent account. @@ -6958,19 +6961,19 @@ the parent account. @c @command{xml} report. @item --amount-data -@itemx -j +@itemx -j @c option Change the @command{register} report so that it prints nothing but the date and the value column, and the latter without commodities. This is only meaningful if the report uses a single commodity. This data can then be fed to other programs, which could plot the date, analyze it, etc. -@item --total-data +@item --total-data @c option @itemx -J Change the @command{register} report so that it prints nothing but the date and total columns, without commodities. -@item --display @var{EXPR} +@item --display @var{EXPR} @c option @itemx -d @var{EXPR} Limit which postings or accounts are actually displayed in a report. They might still be calculated, and be part of the running total of a @@ -6997,7 +7000,7 @@ amount for the reporting range (using @option{--period @var{PERIOD_EXPRESSION} (-p)}), or simply a display restricted to the reporting range (using @option{--display @var{EXPR} (-d)}). -@item --date-format @var{DATE_FORMAT} +@item --date-format @var{DATE_FORMAT} @c option @itemx -y @var{DATE_FORMAT} Change the basic date format used by reports. The default uses a date like @samp{2004/08/01}, which represents the default date format of @@ -7006,13 +7009,13 @@ easiest way is to put @option{--date-format @var{DATE_FORMAT}} in the Ledger initialization file @file{~/.ledgerrc} (or the file referred to by @env{LEDGER_INIT}). -@item --format @var{FORMAT_STRING} +@item --format @var{FORMAT_STRING} @c option @itemx -F @var{FORMAT_STRING} Set the reporting format for whatever report ledger is about to make. @xref{Format Strings}. There are also specific format commands for each report type: -@item --balance-format @var{FORMAT_STRING} +@item --balance-format @var{FORMAT_STRING} @c option Define the output format for the @command{balance} report. The default (defined in @file{report.h} is: @@ -7030,7 +7033,7 @@ Define the output format for the @command{balance} report. The default --------------------\n" @end smallexample -@item --cleared-format @var{FORMAT_STRING} +@item --cleared-format @var{FORMAT_STRING} @c option Define the format for the cleared report. The default is: @smallexample @@ -7045,7 +7048,7 @@ Define the format for the cleared report. The default is: ---------------- ---------------- ---------\n" @end smallexample -@item --register-format @var{FORMAT_STRING} +@item --register-format @var{FORMAT_STRING} @c option Define the output format for the @command{register} report. The default (defined in @file{report.h} is: @@ -7097,7 +7100,7 @@ Set the format for @command{csv} reports. The default is: %(quoted(join(note | xact.note)))\n" @end smallexample -@item --plot-amount-format @var{FORMAT_STRING} +@item --plot-amount-format @var{FORMAT_STRING} @c option Set the format for amount plots, using the @option{--amount-data (-j)} option. The default is: @@ -7105,7 +7108,7 @@ option. The default is: "%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_amount)))\n" @end smallexample -@item --plot-total-format @var{FORMAT_STRING} +@item --plot-total-format @var{FORMAT_STRING} @c option Set the format for total plots, using the @option{--total-data (-J)} option. The default is: @@ -7113,14 +7116,14 @@ option. The default is: "%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_total)))\n" @end smallexample -@item --pricedb-format @var{FORMAT_STRING} +@item --pricedb-format @var{FORMAT_STRING} @c option Set the format expected for the historical price file. The default is: @smallexample "P %(datetime) %(display_account) %(scrub(display_amount))\n" @end smallexample -@item --prices-format @var{FORMAT_STRING} +@item --prices-format @var{FORMAT_STRING} @c option Set the format for the @command{prices} report. The default is: @smallexample @@ -7137,7 +7140,7 @@ These options affect how commodity values are displayed: @ftable @code -@item --price-db @var{FILE} +@item --price-db @var{FILE} @c option Set the file that is used for recording downloaded commodity prices. It is always read on startup, to determine historical prices. Other settings can be placed in this file manually, to prevent downloading @@ -7158,7 +7161,7 @@ download script maintain this file. The format of the file can be changed by telling ledger to use the @option{--pricedb-format @var{FORMAT_STRING}} you define. -@item --price-exp @var{INT} +@item --price-exp @var{INT} @c option @itemx -Z @var{INT} Set the expected freshness of price quotes, in @var{INT} minutes. That is, if the last known quote for any commodity is older than this value, @@ -7166,7 +7169,7 @@ and if @option{--download} is being used, then the Internet will be consulted again for a newer price. Otherwise, the old price is still considered to be fresh enough. -@item --download +@item --download @c option @itemx -Q Cause quotes to be automagically downloaded, as needed, by running a script named @file{getquote} and expecting that script to return @@ -7187,19 +7190,19 @@ reporting needs: @ftable @code -@item --quantity +@item --quantity @c option @itemx -O Report commodity totals (this is the default). -@item --basis +@item --basis @c option @itemx -B Report the cost basis for all postings. -@item --market +@item --market @c option @itemx -V Use the last known value for commodities to calculate final values. -@item --gain +@item --gain @c option @itemx -G Report the net gain/loss for all commodities in the report that have a price history. diff --git a/src/global.cc b/src/global.cc index 602e216c..bf1f453c 100644 --- a/src/global.cc +++ b/src/global.cc @@ -321,9 +321,6 @@ option_t<global_scope_t> * global_scope_t::lookup_option(const char * p) break; case 'h': OPT_(help); - else OPT(help_calc); - else OPT(help_comm); - else OPT(help_disp); break; case 'i': OPT(init_file_); diff --git a/src/global.h b/src/global.h index f36dbe3d..292c9cb0 100644 --- a/src/global.h +++ b/src/global.h @@ -147,9 +147,6 @@ See LICENSE file included with the distribution for details and disclaimer."); OPTION_(global_scope_t, full_help, DO() { parent->visit_man_page(); }); // -H OPTION_(global_scope_t, help, DO() { parent->visit_man_page(); }); // -h - OPTION_(global_scope_t, help_calc, DO() { parent->visit_man_page(); }); - OPTION_(global_scope_t, help_comm, DO() { parent->visit_man_page(); }); - OPTION_(global_scope_t, help_disp, DO() { parent->visit_man_page(); }); OPTION__ (global_scope_t, init_file_, // -i diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 44db81fb..37224d40 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -42,10 +42,15 @@ if (PYTHONINTERP_FOUND) foreach(TestFile ${${_class}_TESTS}) get_filename_component(TestFile_Name ${TestFile} NAME_WE) add_test(NAME ${_class}Test_${TestFile_Name} - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py --ledger $<TARGET_FILE:ledger> --file ${TestFile}) set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) endforeach() + + set(_class CheckTests) + add_test(NAME ${_class} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py + --ledger $<TARGET_FILE:ledger> --source ${PROJECT_SOURCE_DIR}) endif() ### CMakeLists.txt ends here diff --git a/test/CheckTests.py b/test/CheckTests.py index 1a364ff4..cb9e431e 100755 --- a/test/CheckTests.py +++ b/test/CheckTests.py @@ -1,87 +1,136 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function import sys import re import os +import argparse from os.path import * from subprocess import Popen, PIPE -ledger_binary = sys.argv[1] -source_topdir = sys.argv[2] - -documented_options = [] -for line in open(join(source_topdir, 'doc', 'ledger.1')): - match = re.match('\.It Fl \\\\-([-A-Za-z]+)', line) - if match: - option = match.group(1) - if option not in documented_options: - documented_options.append(option) - -pipe = Popen('%s --debug option.names parse true' % ledger_binary, - shell=True, stdout=PIPE, stderr=PIPE) -errors = 0 - -untested_options = [ - 'anon', - 'args-only', - 'cache', - 'debug', - 'download', - 'file', - 'force-color', - 'force-pager', - 'full-help', - 'help', - 'help-calc', - 'help-comm', - 'help-disp', - 'import', - 'init-file', - 'no-color', - 'options', - 'price-db', - 'price-exp', - 'revalued-total', - 'script', - 'seed', - 'trace', - 'verbose', - 'verify', - 'version' -] - -for line in pipe.stderr: - match = re.search('\[DEBUG\] Option: (.*)', line) - if match: - option = match.group(1) - - option = re.sub('_', '-', option) - option = re.sub('-$', '', option) - - if option not in untested_options and \ - not exists(join(source_topdir, 'test', 'baseline', - 'opt-%s.test' % option)): - print "Baseline test missing for --%s" % option - errors += 1 - - if option not in documented_options: - print "Man page entry missing for --%s" % option - errors += 1 - else: - documented_options.remove(option) - -known_alternates = [ - 'cost', - 'first', - 'import', - 'last', - 'leeway', - 'period-sort' -] - -for option in documented_options: - if option not in known_alternates: - print "Man page entry for unknown option --%s" % option - -sys.exit(errors) +class CheckTests (object): + def __init__(self, args): + self.ledger = os.path.abspath(args.ledger) + self.source = os.path.abspath(args.source) + + self.missing_baseline_tests = set() + self.missing_texi_options = set() + self.unknown_texi_options = set() + self.missing_man_options = set() + self.unknown_man_options = set() + + self.untested_options = [ + 'anon', + 'args-only', + 'cache', + 'debug', + 'download', + 'file', + 'force-color', + 'force-pager', + 'full-help', + 'help', + 'help-calc', + 'help-comm', + 'help-disp', + 'import', + 'init-file', + 'no-color', + 'options', + 'price-db', + 'price-exp', + 'revalued-total', + 'script', + 'seed', + 'trace', + 'verbose', + 'verify', + 'version' + ] + + self.known_alternates = [ + 'cost', + 'first', + 'import', + 'last', + 'leeway', + 'period-sort' + ] + + def find_options(self, pattern, filename): + regex = re.compile(pattern) + return {match.group(1) for match in {regex.match(line) for line in open(filename)} if match} + + def main(self): + man_options = self.find_options('\.It Fl \\\\-([-A-Za-z]+)', + join(self.source, 'doc', 'ledger.1')) + + texi_options = self.find_options('@item --([-A-Za-z]+).*@c option', + join(self.source, 'doc', 'ledger3.texi')) + + pipe = Popen('%s --debug option.names parse true' % self.ledger, + shell=True, stdout=PIPE, stderr=PIPE) + regex = re.compile('\[DEBUG\] Option: (.*)') + for line in filter(regex.search, [line.decode() for line in pipe.stderr]): + match = regex.search(line) + option = match.group(1) + option = re.sub('_', '-', option) + option = re.sub('-$', '', option) + + if option not in self.untested_options and \ + not exists(join(self.source, 'test', 'baseline', + 'opt-%s.test' % option)): + self.missing_baseline_tests.add(option) + + if option not in man_options: + self.missing_man_options.add(option) + else: + man_options.remove(option) + + if option not in texi_options: + self.missing_texi_options.add(option) + else: + texi_options.remove(option) + + self.unknown_man_options = [option for option in man_options if option not in self.known_alternates] + self.unknown_texi_options = [option for option in texi_options if option not in self.known_alternates] + + sep = "\n --" + if len(self.missing_baseline_tests): + print("Missing Baseline test for:%s%s\n" % (sep, sep.join(sorted(list(self.missing_baseline_tests))))) + if len(self.missing_man_options): + print("Missing man page entries for:%s%s\n" % (sep, sep.join(sorted(list(self.missing_man_options))))) + if len(self.missing_texi_options): + print("Missing texi entries for:%s%s\n" % (sep, sep.join(sorted(list(self.missing_texi_options))))) + if len(self.unknown_man_options): + print("Man page entry for unknown options:%s%s" % (sep, sep.join(sorted(list(self.unknown_man_options))))) + if len(self.unknown_texi_options): + print("Texi entry for unknown option:%s%s" % (sep, sep.join(sorted(list(self.unknown_texi_options))))) + + errors = len(self.missing_baseline_tests) + len(self.missing_man_options) + len(self.missing_baseline_tests) + return errors + +if __name__ == "__main__": + def getargs(): + parser = argparse.ArgumentParser(prog='CheckTests', description='Check that ledger options are tested and documented', prefix_chars='-') + parser.add_argument('-l', '--ledger', + dest='ledger', + type=str, + action='store', + required=True, + help='the path to the ledger executable to test with') + parser.add_argument('-s', '--source', + dest='source', + type=str, + action='store', + required=True, + help='the path to the top level ledger source directory') + return parser.parse_args() + + args = getargs() + script = CheckTests(args) + status = script.main() + sys.exit(status) diff --git a/test/GenerateTests.py b/test/GenerateTests.py index 2e956db0..1a9045a2 100755 --- a/test/GenerateTests.py +++ b/test/GenerateTests.py @@ -79,6 +79,8 @@ def generation_test(seed): p_cout_bal.stdin.close() cout_lines = harness.readlines(p_cout_bal.stdout) + if len(cout_lines) == 0: + return False #norm_cout_lines = [normalize(line) for line in cout_lines] if not harness.wait(p_cout_bal, msg=("Stdout balance for seed %d failed:" % seed)): @@ -89,6 +91,8 @@ def generation_test(seed): p_print_bal.stdin.close() print_lines = harness.readlines(p_print_bal.stdout) + if len(print_lines) == 0: + return False if not harness.wait(p_print_bal, msg=("Print balance for seed %d failed:" % seed)): return False diff --git a/test/RegressTests.py b/test/RegressTests.py index 01e14191..0fef2127 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -57,6 +57,9 @@ class RegressFile(object): in_error = False line = self.fd.readline() + if not line: + print >>sys.stderr, "WARNING: Empty testfile detected: %s" % (self.filename) + return False #print "line =", line while line: if line.startswith("test "): diff --git a/test/baseline/opt-no-titles.test b/test/baseline/opt-no-titles.test index e69de29b..40a9b421 100644 --- a/test/baseline/opt-no-titles.test +++ b/test/baseline/opt-no-titles.test @@ -0,0 +1,10 @@ +test reg -f test/input/drewr3.dat --no-titles --group-by payee reg food +11-Jan-02 Grocery Store Expense:Food:Groceries $ 65.00 $ 65.00 +11-Jan-19 Grocery Store Expense:Food:Groceries $ 44.00 $ 109.00 +10-Dec-20 Organic Co-op Expense:Food:Groceries $ 37.50 $ 37.50 + Expense:Food:Groceries $ 37.50 $ 75.00 + Expense:Food:Groceries $ 37.50 $ 112.50 + Expense:Food:Groceries $ 37.50 $ 150.00 + Expense:Food:Groceries $ 37.50 $ 187.50 + Expense:Food:Groceries $ 37.50 $ 225.00 +end test diff --git a/test/baseline/opt-values.test b/test/baseline/opt-values.test new file mode 100644 index 00000000..35eeeaf6 --- /dev/null +++ b/test/baseline/opt-values.test @@ -0,0 +1,6 @@ +test tags -f test/input/drewr3.dat --values +hastag: not block +hastag: true +nestedtag: true +nobudget +end test |