cli: Commands.Aregister: --header -> --heading

This commit is contained in:
Henning Thielemann 2024-10-31 09:34:38 +01:00 committed by Simon Michael
parent 6adda683dc
commit d176215f03
2 changed files with 11 additions and 11 deletions

View File

@ -57,8 +57,8 @@ aregistermode = hledgerCommandMode
-- "show running average of posting amounts instead of total (implies --empty)"
-- ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
,flagReq ["header"] (\s opts -> Right $ setopt "header" s opts) "YN"
"show header row above table: yes (default) or no"
,flagReq ["heading"] (\s opts -> Right $ setopt "heading" s opts) "YN"
"show heading row above table: yes (default) or no"
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"
("set output width (default: " ++
#ifdef mingw32_HOST_OS
@ -128,7 +128,7 @@ aregister opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j = do
| fmt=="json" = toJsonText
| otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:
where
hd = headeropt opts
hd = headingopt opts
fmt = outputFormatFromOpts opts
writeOutputLazyText opts $ render items'
@ -179,7 +179,7 @@ accountTransactionsReportAsHTML copts reportq thisacctq items =
L.renderText $ do
L.link_ [L.rel_ "stylesheet", L.href_ "hledger.css"]
L.table_ $ do
when (headeropt copts) $ L.thead_ $ L.tr_ $ do
when (headingopt copts) $ L.thead_ $ L.tr_ $ do
L.th_ "date"
L.th_ "description"
L.th_ "otheraccounts"
@ -195,7 +195,7 @@ accountTransactionsReportAsHTML copts reportq thisacctq items =
-- | Render a register report as plain text suitable for console output.
accountTransactionsReportAsText :: CliOpts -> Query -> Query -> AccountTransactionsReport -> TL.Text
accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $
(optional (headeropt copts) $ title <> TB.singleton '\n')
(optional (headingopt copts) $ title <> TB.singleton '\n')
<>
postingsOrTransactionsReportAsText alignAll copts itemAsText itemamt itembal items
where
@ -218,8 +218,8 @@ accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $
length (querystring_ $ _rsReportOpts $ reportspec_ copts) > 1
&& not (queryIsNull $ filterQuery (not.(\q->queryIsDepth q || queryIsDateOrDate2 q)) reportq)
headeropt :: CliOpts -> Bool
headeropt = fromMaybe True . maybeynopt "header" . rawopts_
headingopt :: CliOpts -> Bool
headingopt = fromMaybe True . maybeynopt "heading" . rawopts_
optional :: (Monoid p) => Bool -> p -> p
optional b x = if b then x else mempty

View File

@ -13,7 +13,7 @@ Flags:
--no-elide don't show only 2 commodities per amount
--cumulative show running total from report start date
--invert display all amounts with reversed sign
--header=YN show header row above table: yes (default) or no
--heading=YN show heading row above table: yes (default) or no
-w --width=N set output width (default: terminal width or
$COLUMNS). -wN,M sets description width as well.
--align-all guarantee alignment across all lines (slower)
@ -76,10 +76,10 @@ this means unusually wide values in later lines can cause visual discontinuities
as column widths are adjusted. If you want to ensure perfect alignment,
at the cost of more time and memory, use the `--align-all` flag.
By default, `aregister` shows a header above the data.
By default, `aregister` shows a heading above the data.
However, when reporting in a language different from English,
it is easier to omit this header and prepend your own one.
For this purpose, use the `--header=no` option.
it is easier to omit this heading and prepend your own one.
For this purpose, use the `--heading=no` option.
This command also supports the
[output destination](hledger.html#output-destination) and