From b246d0e9901c5b3aa0404a0d0ea2e6ff5a8f6725 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 27 Aug 2017 08:26:47 -0700 Subject: [PATCH] cf: more restrictive regexp (#584) --- hledger-lib/Hledger/Data/Journal.hs | 4 +- hledger/doc/commands.m4.md | 3 +- hledger/doc/hledger.1 | 4 +- hledger/doc/hledger.1.info | 122 +++++++++--------- hledger/doc/hledger.1.txt | 192 ++++++++++++++-------------- 5 files changed, 162 insertions(+), 163 deletions(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 29bf9ff28..130d00c12 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -293,9 +293,9 @@ journalEquityAccountQuery _ = Acct "^equity(:|$)" -- | A query for Cash (-equivalent) accounts in this journal (ie, -- accounts which appear on the cashflow statement.) This is currently -- hard-coded to be all the Asset accounts except for those containing the --- case-insensitive regex @(receivable|A/R|fixed)@. +-- case-insensitive regex @(receivable|:A/R|:fixed)@. journalCashAccountQuery :: Journal -> Query -journalCashAccountQuery j = And [journalAssetAccountQuery j, Not $ Acct "(receivable|A/R|fixed)"] +journalCashAccountQuery j = And [journalAssetAccountQuery j, Not $ Acct "(receivable|:A/R|:fixed)"] -- Various kinds of filtering on journals. We do it differently depending -- on the command. diff --git a/hledger/doc/commands.m4.md b/hledger/doc/commands.m4.md index 4bd3fb6c3..f04cf6caa 100644 --- a/hledger/doc/commands.m4.md +++ b/hledger/doc/commands.m4.md @@ -276,8 +276,7 @@ This command displays a simple [cashflow statement](http://en.wikipedia.org/wiki/Cash_flow_statement) It shows the change in all "cash" (ie, liquid assets) accounts for the period. It currently assumes that cash accounts are under a top-level -account named `asset` and do not contain `receivable` or `A/R` (plural -forms also allowed.) +account named `asset` and do not contain `receivable`, `:A/R` or `:fixed`. ```shell $ hledger cashflow diff --git a/hledger/doc/hledger.1 b/hledger/doc/hledger.1 index 5065d03d3..591d6ea92 100644 --- a/hledger/doc/hledger.1 +++ b/hledger/doc/hledger.1 @@ -1818,8 +1818,8 @@ in single\-column balance reports: use this custom line format This command displays a simple cashflow statement It shows the change in all "cash" (ie, liquid assets) accounts for the period. It currently assumes that cash accounts are under a top\-level account -named \f[C]asset\f[] and do not contain \f[C]receivable\f[] or -\f[C]A/R\f[] (plural forms also allowed.) +named \f[C]asset\f[] and do not contain \f[C]receivable\f[], +\f[C]:A/R\f[] or \f[C]:fixed\f[]. .IP .nf \f[C] diff --git a/hledger/doc/hledger.1.info b/hledger/doc/hledger.1.info index 16229d410..d1a16d140 100644 --- a/hledger/doc/hledger.1.info +++ b/hledger/doc/hledger.1.info @@ -1411,7 +1411,7 @@ Show a cashflow statement. Alias: cf. This command displays a simple cashflow statement It shows the change in all "cash" (ie, liquid assets) accounts for the period. It currently assumes that cash accounts are under a top-level account named 'asset' -and do not contain 'receivable' or 'A/R' (plural forms also allowed.) +and do not contain 'receivable', ':A/R' or ':fixed'. $ hledger cashflow Cashflow Statement @@ -2144,65 +2144,65 @@ Node: balancesheet43148 Ref: #balancesheet43276 Node: cashflow45183 Ref: #cashflow45300 -Node: help47168 -Ref: #help47280 -Node: incomestatement48354 -Ref: #incomestatement48485 -Node: print50377 -Ref: #print50492 -Node: register54248 -Ref: #register54361 -Node: Custom register output58857 -Ref: #custom-register-output58988 -Node: stats60285 -Ref: #stats60391 -Node: test61272 -Ref: #test61359 -Node: ADD-ON COMMANDS61727 -Ref: #add-on-commands61839 -Node: Official add-ons63126 -Ref: #official-add-ons63268 -Node: api63355 -Ref: #api63446 -Node: ui63498 -Ref: #ui63599 -Node: web63657 -Ref: #web63748 -Node: Third party add-ons63794 -Ref: #third-party-add-ons63971 -Node: diff64106 -Ref: #diff64205 -Node: iadd64304 -Ref: #iadd64420 -Node: interest64503 -Ref: #interest64626 -Node: irr64721 -Ref: #irr64821 -Node: Experimental add-ons64899 -Ref: #experimental-add-ons65053 -Node: autosync65455 -Ref: #autosync65569 -Node: budget65808 -Ref: #budget65932 -Node: chart65998 -Ref: #chart66117 -Node: check66188 -Ref: #check66312 -Node: check-dates66379 -Ref: #check-dates66521 -Node: check-dupes66594 -Ref: #check-dupes66737 -Node: equity66814 -Ref: #equity66942 -Node: prices67061 -Ref: #prices67190 -Node: print-unique67245 -Ref: #print-unique67394 -Node: register-match67487 -Ref: #register-match67643 -Node: rewrite67741 -Ref: #rewrite67875 -Node: tags67953 -Ref: #tags68058 +Node: help47151 +Ref: #help47263 +Node: incomestatement48337 +Ref: #incomestatement48468 +Node: print50360 +Ref: #print50475 +Node: register54231 +Ref: #register54344 +Node: Custom register output58840 +Ref: #custom-register-output58971 +Node: stats60268 +Ref: #stats60374 +Node: test61255 +Ref: #test61342 +Node: ADD-ON COMMANDS61710 +Ref: #add-on-commands61822 +Node: Official add-ons63109 +Ref: #official-add-ons63251 +Node: api63338 +Ref: #api63429 +Node: ui63481 +Ref: #ui63582 +Node: web63640 +Ref: #web63731 +Node: Third party add-ons63777 +Ref: #third-party-add-ons63954 +Node: diff64089 +Ref: #diff64188 +Node: iadd64287 +Ref: #iadd64403 +Node: interest64486 +Ref: #interest64609 +Node: irr64704 +Ref: #irr64804 +Node: Experimental add-ons64882 +Ref: #experimental-add-ons65036 +Node: autosync65438 +Ref: #autosync65552 +Node: budget65791 +Ref: #budget65915 +Node: chart65981 +Ref: #chart66100 +Node: check66171 +Ref: #check66295 +Node: check-dates66362 +Ref: #check-dates66504 +Node: check-dupes66577 +Ref: #check-dupes66720 +Node: equity66797 +Ref: #equity66925 +Node: prices67044 +Ref: #prices67173 +Node: print-unique67228 +Ref: #print-unique67377 +Node: register-match67470 +Ref: #register-match67626 +Node: rewrite67724 +Ref: #rewrite67858 +Node: tags67936 +Ref: #tags68041  End Tag Table diff --git a/hledger/doc/hledger.1.txt b/hledger/doc/hledger.1.txt index 6af34073a..3a53bd914 100644 --- a/hledger/doc/hledger.1.txt +++ b/hledger/doc/hledger.1.txt @@ -1263,7 +1263,7 @@ COMMANDS This command displays a simple cashflow statement It shows the change in all "cash" (ie, liquid assets) accounts for the period. It cur- rently assumes that cash accounts are under a top-level account named - asset and do not contain receivable or A/R (plural forms also allowed.) + asset and do not contain receivable, :A/R or :fixed. $ hledger cashflow Cashflow Statement @@ -1280,20 +1280,20 @@ COMMANDS $-1 With a reporting interval, multiple columns will be shown, one for each - report period. Normally cashflow shows changes in assets per period, - though as with multicolumn balance reports you can alter the report + report period. Normally cashflow shows changes in assets per period, + though as with multicolumn balance reports you can alter the report mode with --change/--cumulative/--historical. help Show any of the hledger manuals. - The help command displays any of the main hledger manuals, in one of - several ways. Run it with no argument to list the manuals, or provide + The help command displays any of the main hledger manuals, in one of + several ways. Run it with no argument to list the manuals, or provide a full or partial manual name to select one. - hledger manuals are available in several formats. hledger help will - use the first of these display methods that it finds: info, man, - $PAGER, less, stdout (or when non-interactive, just stdout). You can + hledger manuals are available in several formats. hledger help will + use the first of these display methods that it finds: info, man, + $PAGER, less, stdout (or when non-interactive, just stdout). You can force a particular viewer with the --info, --man, --pager, --cat flags. $ hledger help @@ -1323,7 +1323,7 @@ COMMANDS show balance change in each period (default) --cumulative - show balance change accumulated across periods (in multicolumn + show balance change accumulated across periods (in multicolumn reports), instead of changes during periods -H --historical @@ -1354,8 +1354,8 @@ COMMANDS --format=LINEFORMAT in single-column balance reports: use this custom line format - This command displays a simple income statement. It currently assumes - that you have top-level accounts named income (or revenue) and expense + This command displays a simple income statement. It currently assumes + that you have top-level accounts named income (or revenue) and expense (plural forms also allowed.) $ hledger incomestatement @@ -1380,8 +1380,8 @@ COMMANDS 0 With a reporting interval, multiple columns will be shown, one for each - report period. Normally incomestatement shows revenues/expenses per - period, though as with multicolumn balance reports you can alter the + report period. Normally incomestatement shows revenues/expenses per + period, though as with multicolumn balance reports you can alter the report mode with --change/--cumulative/--historical. print @@ -1391,14 +1391,14 @@ COMMANDS show all amounts explicitly -m STR --match=STR - show the transaction whose description is most similar to STR, + show the transaction whose description is most similar to STR, and is most recent -O FMT --output-format=FMT select the output format. Supported formats: txt, csv. -o FILE --output-file=FILE - write output to FILE. A file extension matching one of the + write output to FILE. A file extension matching one of the above formats selects that format. $ hledger print @@ -1426,23 +1426,23 @@ COMMANDS The print command displays full journal entries (transactions) from the journal file, tidily formatted. - As of hledger 1.2, print's output is always a valid hledger journal. - However it may not preserve all original content, eg it does not print + As of hledger 1.2, print's output is always a valid hledger journal. + However it may not preserve all original content, eg it does not print directives or inter-transaction comments. - Normally, transactions' implicit/explicit amount style is preserved: - when an amount is omitted in the journal, it will be omitted in the - output. You can use the -x/--explicit flag to make all amounts - explicit, which can be useful for troubleshooting or for making your - journal more readable and robust against data entry errors. Note, in - this mode postings with a multi-commodity amount (possible with an - implicit amount in a multi-commodity transaction) will be split into + Normally, transactions' implicit/explicit amount style is preserved: + when an amount is omitted in the journal, it will be omitted in the + output. You can use the -x/--explicit flag to make all amounts + explicit, which can be useful for troubleshooting or for making your + journal more readable and robust against data entry errors. Note, in + this mode postings with a multi-commodity amount (possible with an + implicit amount in a multi-commodity transaction) will be split into multiple single-commodity postings, for valid journal output. - With -B/--cost, amounts with transaction prices are converted to cost + With -B/--cost, amounts with transaction prices are converted to cost (using the transaction price). - The print command also supports output destination and CSV output. + The print command also supports output destination and CSV output. Here's an example of print's CSV output: $ hledger print -Ocsv @@ -1459,20 +1459,20 @@ COMMANDS "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" - o There is one CSV record per posting, with the parent transaction's + o There is one CSV record per posting, with the parent transaction's fields repeated. o The "txnidx" (transaction index) field shows which postings belong to - the same transaction. (This number might change if transactions are - reordered within the file, files are parsed/included in a different + the same transaction. (This number might change if transactions are + reordered within the file, files are parsed/included in a different order, etc.) - o The amount is separated into "commodity" (the symbol) and "amount" + o The amount is separated into "commodity" (the symbol) and "amount" (numeric quantity) fields. o The numeric amount is repeated in either the "credit" or "debit" col- - umn, for convenience. (Those names are not accurate in the account- - ing sense; it just puts negative amounts under credit and zero or + umn, for convenience. (Those names are not accurate in the account- + ing sense; it just puts negative amounts under credit and zero or greater amounts under debit.) register @@ -1482,7 +1482,7 @@ COMMANDS show running total from report start date (default) -H --historical - show historical running total/balance (includes postings before + show historical running total/balance (includes postings before report start date) -A --average @@ -1493,18 +1493,18 @@ COMMANDS show postings' siblings instead -w N --width=N - set output width (default: terminal width or COLUMNS. -wN,M + set output width (default: terminal width or COLUMNS. -wN,M sets description width as well) -O FMT --output-format=FMT select the output format. Supported formats: txt, csv. -o FILE --output-file=FILE - write output to FILE. A file extension matching one of the + write output to FILE. A file extension matching one of the above formats selects that format. The register command displays postings, one per line, and their running - total. This is typically used with a query selecting a particular + total. This is typically used with a query selecting a particular account, to see that account's activity: $ hledger register checking @@ -1513,8 +1513,8 @@ COMMANDS 2008/06/02 save assets:bank:checking $-1 $1 2008/12/31 pay off assets:bank:checking $-1 0 - The --historical/-H flag adds the balance from any undisplayed prior - postings to the running total. This is useful when you want to see + The --historical/-H flag adds the balance from any undisplayed prior + postings to the running total. This is useful when you want to see only recent activity, with a historically accurate running balance: $ hledger register checking -b 2008/6 --historical @@ -1524,23 +1524,23 @@ COMMANDS The --depth option limits the amount of sub-account detail displayed. - The --average/-A flag shows the running average posting amount instead + The --average/-A flag shows the running average posting amount instead of the running total (so, the final number displayed is the average for - the whole report period). This flag implies --empty (see below). It - is affected by --historical. It works best when showing just one + the whole report period). This flag implies --empty (see below). It + is affected by --historical. It works best when showing just one account and one commodity. - The --related/-r flag shows the other postings in the transactions of + The --related/-r flag shows the other postings in the transactions of the postings which would normally be shown. - With a reporting interval, register shows summary postings, one per + With a reporting interval, register shows summary postings, one per interval, aggregating the postings to each account: $ hledger register --monthly income 2008/01 income:salary $-1 $-1 2008/06 income:gifts $-1 $-2 - Periods with no activity, and summary postings with a zero amount, are + Periods with no activity, and summary postings with a zero amount, are not shown by default; use the --empty/-E flag to see them: $ hledger register --monthly income -E @@ -1557,7 +1557,7 @@ COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth + Often, you'll want to see just one line per interval. The --depth option helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -1565,19 +1565,19 @@ COMMANDS 2008/06 assets $-1 0 2008/12 assets $-1 $-1 - Note when using report intervals, if you specify start/end dates these - will be adjusted outward if necessary to contain a whole number of - intervals. This ensures that the first and last intervals are full + Note when using report intervals, if you specify start/end dates these + will be adjusted outward if necessary to contain a whole number of + intervals. This ensures that the first and last intervals are full length and comparable to the others in the report. Custom register output - register uses the full terminal width by default, except on windows. - You can override this by setting the COLUMNS environment variable (not + register uses the full terminal width by default, except on windows. + You can override this by setting the COLUMNS environment variable (not a bash shell variable) or by using the --width/-w option. - The description and account columns normally share the space equally - (about half of (width - 40) each). You can adjust this by adding a - description width as part of --width's argument, comma-separated: + The description and account columns normally share the space equally + (about half of (width - 40) each). You can adjust this by adding a + description width as part of --width's argument, comma-separated: --width W,D . Here's a diagram: <--------------------------------- width (W) ----------------------------------> @@ -1593,14 +1593,14 @@ COMMANDS $ hledger reg -w 100,40 # set overall width 100, description width 40 $ hledger reg -w $COLUMNS,40 # use terminal width, and set description width - The register command also supports the -o/--output-file and -O/--out- + The register command also supports the -o/--output-file and -O/--out- put-format options for controlling output destination and CSV output. stats Show some journal statistics. -o FILE --output-file=FILE - write output to FILE. A file extension matching one of the + write output to FILE. A file extension matching one of the above formats selects that format. $ hledger stats @@ -1615,8 +1615,8 @@ COMMANDS Accounts : 8 (depth 3) Commodities : 1 ($) - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. The stats command also supports -o/--output-file for controlling output @@ -1628,34 +1628,34 @@ COMMANDS $ hledger test Cases: 74 Tried: 74 Errors: 0 Failures: 0 - This command runs hledger's built-in unit tests and displays a quick + This command runs hledger's built-in unit tests and displays a quick report. With a regular expression argument, it selects only tests with matching names. It's mainly used in development, but it's also nice to be able to check your hledger executable for smoke at any time. ADD-ON COMMANDS - hledger also searches for external add-on commands, and will include + hledger also searches for external add-on commands, and will include these in the commands list. These are programs or scripts in your PATH - whose name starts with hledger- and ends with a recognised file exten- + whose name starts with hledger- and ends with a recognised file exten- sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). - Add-ons can be invoked like any hledger command, but there are a few + Add-ons can be invoked like any hledger command, but there are a few things to be aware of. Eg if the hledger-web add-on is installed, o hledger -h web shows hledger's help, while hledger web -h shows hledger-web's help. - o Flags specific to the add-on must have a preceding -- to hide them - from hledger. So hledger web --serve --port 9000 will be rejected; + o Flags specific to the add-on must have a preceding -- to hide them + from hledger. So hledger web --serve --port 9000 will be rejected; you must use hledger web -- --serve --port 9000. - o You can always run add-ons directly if preferred: + o You can always run add-ons directly if preferred: hledger-web --serve --port 9000. - Add-ons are a relatively easy way to add local features or experiment - with new ideas. They can be written in any language, but haskell - scripts have a big advantage: they can use the same hledger (and - haskell) library functions that built-in commands do, for command-line + Add-ons are a relatively easy way to add local features or experiment + with new ideas. They can be written in any language, but haskell + scripts have a big advantage: they can use the same hledger (and + haskell) library functions that built-in commands do, for command-line options, journal parsing, reporting, etc. Here are some hledger add-ons available: @@ -1673,7 +1673,7 @@ ADD-ON COMMANDS hledger-web provides a simple web interface. Third party add-ons - These are maintained separately, and usually updated shortly after a + These are maintained separately, and usually updated shortly after a hledger release. diff @@ -1681,7 +1681,7 @@ ADD-ON COMMANDS journal file and another. iadd - hledger-iadd is a curses-style, more interactive replacement for the + hledger-iadd is a curses-style, more interactive replacement for the add command. interest @@ -1689,19 +1689,19 @@ ADD-ON COMMANDS ing to various schemes. irr - hledger-irr calculates the internal rate of return of an investment + hledger-irr calculates the internal rate of return of an investment account. Experimental add-ons - These are available in source form in the hledger repo's bin/ direc- + These are available in source form in the hledger repo's bin/ direc- tory; installing them is pretty easy. They may be less mature and doc- - umented than built-in commands. Reading and tweaking these is a good + umented than built-in commands. Reading and tweaking these is a good way to start making your own! autosync hledger-autosync is a symbolic link for easily running ledger-autosync, - if installed. ledger-autosync does deduplicating conversion of OFX - data and some CSV formats, and can also download the data if your bank + if installed. ledger-autosync does deduplicating conversion of OFX + data and some CSV formats, and can also download the data if your bank offers OFX Direct Connect. budget @@ -1717,18 +1717,18 @@ ADD-ON COMMANDS hledger-check-dates.hs checks that journal entries are ordered by date. check-dupes - hledger-check-dupes.hs checks for account names sharing the same leaf + hledger-check-dupes.hs checks for account names sharing the same leaf name. equity - hledger-equity.hs prints balance-resetting transactions, useful for + hledger-equity.hs prints balance-resetting transactions, useful for bringing account balances across file boundaries. prices hledger-prices.hs prints all prices from the journal. print-unique - hledger-print-unique.hs prints transactions which do not reuse an + hledger-print-unique.hs prints transactions which do not reuse an already-seen description. register-match @@ -1743,21 +1743,21 @@ ADD-ON COMMANDS hledger-tags.hs Lists tag names in use. ENVIRONMENT - COLUMNS The screen width used by the register command. Default: the + COLUMNS The screen width used by the register command. Default: the full terminal width. LEDGER_FILE The journal file path when not specified with -f. Default: - ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- + ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). FILES - Reads data from one or more files in hledger journal, timeclock, time- - dot, or CSV format specified with -f, or $LEDGER_FILE, or - $HOME/.hledger.journal (on windows, perhaps + Reads data from one or more files in hledger journal, timeclock, time- + dot, or CSV format specified with -f, or $LEDGER_FILE, or + $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS - The need to precede addon command options with -- when invoked from + The need to precede addon command options with -- when invoked from hledger is awkward. When input data contains non-ascii characters, a suitable system locale @@ -1770,33 +1770,33 @@ BUGS In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. - Not all of Ledger's journal file syntax is supported. See file format + Not all of Ledger's journal file syntax is supported. See file format differences. - On large data files, hledger is slower and uses more memory than + On large data files, hledger is slower and uses more memory than Ledger. TROUBLESHOOTING - Here are some issues you might encounter when you run hledger (and - remember you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and + remember you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - "Illegal byte sequence" or "Invalid or incomplete multibyte or wide + "Illegal byte sequence" or "Invalid or incomplete multibyte or wide character" errors In order to handle non-ascii letters and symbols (like ), hledger needs an appropriate locale. This is usually configured system-wide; you can also configure it temporarily. The locale may need to be one that sup- - ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, + ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, I'm not sure yet). Here's an example of setting the locale temporarily, on ubuntu @@ -1815,7 +1815,7 @@ TROUBLESHOOTING $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile $ bash --login - If we preferred to use eg fr_FR.utf8, we might have to install that + If we preferred to use eg fr_FR.utf8, we might have to install that first: $ apt-get install language-pack-fr @@ -1836,7 +1836,7 @@ TROUBLESHOOTING REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -1850,7 +1850,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1)