From 40b8d2b51754b17536ce3e91d51f597ba0f08024 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 29 Sep 2024 11:52:59 -1000 Subject: [PATCH] imp: balcmds: tweak --base-url help [#2226] --- hledger/Hledger/Cli/Commands/Balance.hs | 8 ++++---- hledger/Hledger/Cli/CompoundBalanceCommand.hs | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 5b60ceb28..dd8ad4213 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -343,9 +343,11 @@ balancemode = hledgerCommandMode ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" - ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "add anchors to table cells with respect to this base URL" ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed." ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" + ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" + ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign" + ,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns" ,flagReq ["layout"] (\s opts -> Right $ setopt "layout" s opts) "ARG" (unlines ["how to lay out multi-commodity amounts and the overall table:" @@ -354,9 +356,7 @@ balancemode = hledgerCommandMode ,"'bare' : commodity symbols in one column" ,"'tidy' : every attribute in its own column" ]) - ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" - ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign" - ,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns" + ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "in html output, generate hyperlinks to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)" -- output: ,outputFormatFlag ["txt","html","csv","tsv","json","fods"] diff --git a/hledger/Hledger/Cli/CompoundBalanceCommand.hs b/hledger/Hledger/Cli/CompoundBalanceCommand.hs index 128642b47..68b0c1b8e 100644 --- a/hledger/Hledger/Cli/CompoundBalanceCommand.hs +++ b/hledger/Hledger/Cli/CompoundBalanceCommand.hs @@ -63,6 +63,8 @@ compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = hledgerCommandMode cbcdoc + -- keep roughly consistent order with Balance.hs. XXX refactor + ([flagNone ["sum"] (setboolopt "sum") "show sum of posting amounts (default)" ,flagNone ["valuechange"] (setboolopt "valuechange") @@ -82,6 +84,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = ("accumulate amounts from journal start to column end (includes postings before report start date)" ++ defaultMarker Historical) ] + ++ flattreeflags True ++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" ,flagNone ["declared"] (setboolopt "declared") "include non-parent declared accounts (best used with -E)" @@ -91,7 +94,6 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" - ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "add anchors to table cells with respect to this base URL" ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name" ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" ,flagReq ["layout"] (\s opts -> Right $ setopt "layout" s opts) "ARG" @@ -101,8 +103,11 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = ,"'tall' : each commodity on a new line" ,"'bare' : bare numbers, symbols in a column" ]) + ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "in html output, generate hyperlinks to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)" + ,outputFormatFlag ["txt","html","csv","tsv","json"] ,outputFileFlag + ]) cligeneralflagsgroups1 (hiddenflags ++