From 05073e9f9d89a5569b83b247b6835c0461909a03 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 26 Jul 2018 07:13:37 +0100 Subject: [PATCH] rewrite: clarify relation to print --auto (#745) [ci skip] --- hledger/Hledger/Cli/Commands/Rewrite.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/Commands/Rewrite.hs b/hledger/Hledger/Cli/Commands/Rewrite.hs index 09d1d53c8..0bc69d41b 100755 --- a/hledger/Hledger/Cli/Commands/Rewrite.hs +++ b/hledger/Hledger/Cli/Commands/Rewrite.hs @@ -23,7 +23,8 @@ import qualified Data.Algorithm.Diff as D rewritemode = hledgerCommandMode [here| rewrite -Print all transactions, adding custom postings to the matched ones. +Print all transactions, rewriting the postings of matched transactions. +For now the only rewrite available is adding new postings, like print --auto. FLAGS @@ -146,6 +147,20 @@ See also: https://github.com/simonmichael/hledger/issues/99 +#### rewrite vs. print --auto + +This command predates print --auto, and currently does much the same thing, +but with these differences: + +- with multiple files, rewrite lets rules in any file affect all other files. + print --auto uses standard directive scoping; rules affect only child files. + +- rewrite's query limits which transactions can be rewritten; all are printed. + print --auto's query limits which transactions are printed. + +- rewrite applies rules specified on command line or in the journal. + print --auto applies rules specified in the journal. + |] [flagReq ["add-posting"] (\s opts -> Right $ setopt "add-posting" s opts) "'ACCT AMTEXPR'" "add a posting to ACCT, which may be parenthesised. AMTEXPR is either a literal amount, or *N which means the transaction's first matched amount multiplied by N (a decimal number). Two spaces separate ACCT and AMTEXPR."