diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index 9267d0c12..4855ca76d 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -281,6 +281,7 @@ balancetypeopt = parse = \case "historical" -> Just HistoricalBalance "cumulative" -> Just CumulativeChange + "periodic" -> Just PeriodChange _ -> Nothing -- Get the period specified by any -b/--begin, -e/--end and/or -p/--period diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 8d9b4f9d1..83b856637 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -122,11 +122,12 @@ and subaccounts. Eg, adding the pattern @o@ to the first example gives: hledger's balance command will show multiple columns when a reporting interval is specified (eg with @--monthly@), one column for each sub-period. -There are three kinds of multi-column balance report, indicated by the heading: +There are three accumulation strategies for multi-column balance report, indicated by +the heading: -* A \"period balance\" (or \"flow\") report (the default) shows the change of account - balance in each period, which is equivalent to the sum of postings in each - period. Here, checking's balance increased by 10 in Feb: +* A \"period balance\" (or \"flow\") report (with @--periodic@, the default) shows the + change of account balance in each period, which is equivalent to the sum of postings + in each period. Here, checking's balance increased by 10 in Feb: > Change of balance (flow): > @@ -279,12 +280,12 @@ import Hledger.Read.CsvReader (CSV, printCSV) -- | Command line options for this command. balancemode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Balance.txt") - ([flagNone ["change"] (setboolopt "change") - "show balance change in each period (default)" + ([flagNone ["periodic"] (setboolopt "periodic") + "accumulate amounts from column start to column end (in multicolumn reports, default)" ,flagNone ["cumulative"] (setboolopt "cumulative") - "show balance change accumulated across periods (in multicolumn reports)" + "accumulate amounts from report start (specified by e.g. -b/--begin) to column end" ,flagNone ["historical","H"] (setboolopt "historical") - "show historical ending balance in each period (includes postings before report start date)\n " + "accumulate amounts from journal start to column end (includes postings before report start date)\n " ] ++ flattreeflags True ++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)" diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index c9332ebfb..630fd7511 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -36,7 +36,7 @@ import Hledger.Cli.Utils registermode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Register.txt") - ([flagNone ["cumulative"] (setboolopt "change") + ([flagNone ["cumulative"] (setboolopt "periodic") "show running total from report start date (default)" ,flagNone ["historical","H"] (setboolopt "historical") "show historical running total/balance (includes postings before report start date)\n " diff --git a/hledger/Hledger/Cli/CompoundBalanceCommand.hs b/hledger/Hledger/Cli/CompoundBalanceCommand.hs index 1412bf39a..cfcf3b5a8 100644 --- a/hledger/Hledger/Cli/CompoundBalanceCommand.hs +++ b/hledger/Hledger/Cli/CompoundBalanceCommand.hs @@ -61,16 +61,15 @@ compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = hledgerCommandMode cbcdoc - ([flagNone ["change"] (setboolopt "change") - ("show balance change in each period" ++ defType PeriodChange) + ([flagNone ["periodic"] (setboolopt "periodic") + ("accumulate amounts from column start to column end (in multicolumn reports)" + ++ defType PeriodChange) ,flagNone ["cumulative"] (setboolopt "cumulative") - ("show balance change accumulated across periods (in multicolumn reports)" - ++ defType CumulativeChange - ) + ("accumulate amounts from report start (specified by e.g. -b/--begin) to column end" + ++ defType CumulativeChange) ,flagNone ["historical","H"] (setboolopt "historical") - ("show historical ending balance in each period (includes postings before report start date)" - ++ defType HistoricalBalance - ) + ("accumulate amounts from journal start to column end (includes postings before report start date)" + ++ defType HistoricalBalance ++ "\n ") ] ++ flattreeflags True ++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"