cli: Commands.Aregister: --header -> --heading
This commit is contained in:
parent
6adda683dc
commit
d176215f03
@ -57,8 +57,8 @@ aregistermode = hledgerCommandMode
|
|||||||
-- "show running average of posting amounts instead of total (implies --empty)"
|
-- "show running average of posting amounts instead of total (implies --empty)"
|
||||||
-- ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"
|
-- ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"
|
||||||
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
|
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
|
||||||
,flagReq ["header"] (\s opts -> Right $ setopt "header" s opts) "YN"
|
,flagReq ["heading"] (\s opts -> Right $ setopt "heading" s opts) "YN"
|
||||||
"show header row above table: yes (default) or no"
|
"show heading row above table: yes (default) or no"
|
||||||
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"
|
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"
|
||||||
("set output width (default: " ++
|
("set output width (default: " ++
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
@ -128,7 +128,7 @@ aregister opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j = do
|
|||||||
| fmt=="json" = toJsonText
|
| fmt=="json" = toJsonText
|
||||||
| otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:
|
| otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:
|
||||||
where
|
where
|
||||||
hd = headeropt opts
|
hd = headingopt opts
|
||||||
fmt = outputFormatFromOpts opts
|
fmt = outputFormatFromOpts opts
|
||||||
|
|
||||||
writeOutputLazyText opts $ render items'
|
writeOutputLazyText opts $ render items'
|
||||||
@ -179,7 +179,7 @@ accountTransactionsReportAsHTML copts reportq thisacctq items =
|
|||||||
L.renderText $ do
|
L.renderText $ do
|
||||||
L.link_ [L.rel_ "stylesheet", L.href_ "hledger.css"]
|
L.link_ [L.rel_ "stylesheet", L.href_ "hledger.css"]
|
||||||
L.table_ $ do
|
L.table_ $ do
|
||||||
when (headeropt copts) $ L.thead_ $ L.tr_ $ do
|
when (headingopt copts) $ L.thead_ $ L.tr_ $ do
|
||||||
L.th_ "date"
|
L.th_ "date"
|
||||||
L.th_ "description"
|
L.th_ "description"
|
||||||
L.th_ "otheraccounts"
|
L.th_ "otheraccounts"
|
||||||
@ -195,7 +195,7 @@ accountTransactionsReportAsHTML copts reportq thisacctq items =
|
|||||||
-- | Render a register report as plain text suitable for console output.
|
-- | Render a register report as plain text suitable for console output.
|
||||||
accountTransactionsReportAsText :: CliOpts -> Query -> Query -> AccountTransactionsReport -> TL.Text
|
accountTransactionsReportAsText :: CliOpts -> Query -> Query -> AccountTransactionsReport -> TL.Text
|
||||||
accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $
|
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
|
postingsOrTransactionsReportAsText alignAll copts itemAsText itemamt itembal items
|
||||||
where
|
where
|
||||||
@ -218,8 +218,8 @@ accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $
|
|||||||
length (querystring_ $ _rsReportOpts $ reportspec_ copts) > 1
|
length (querystring_ $ _rsReportOpts $ reportspec_ copts) > 1
|
||||||
&& not (queryIsNull $ filterQuery (not.(\q->queryIsDepth q || queryIsDateOrDate2 q)) reportq)
|
&& not (queryIsNull $ filterQuery (not.(\q->queryIsDepth q || queryIsDateOrDate2 q)) reportq)
|
||||||
|
|
||||||
headeropt :: CliOpts -> Bool
|
headingopt :: CliOpts -> Bool
|
||||||
headeropt = fromMaybe True . maybeynopt "header" . rawopts_
|
headingopt = fromMaybe True . maybeynopt "heading" . rawopts_
|
||||||
|
|
||||||
optional :: (Monoid p) => Bool -> p -> p
|
optional :: (Monoid p) => Bool -> p -> p
|
||||||
optional b x = if b then x else mempty
|
optional b x = if b then x else mempty
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Flags:
|
|||||||
--no-elide don't show only 2 commodities per amount
|
--no-elide don't show only 2 commodities per amount
|
||||||
--cumulative show running total from report start date
|
--cumulative show running total from report start date
|
||||||
--invert display all amounts with reversed sign
|
--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
|
-w --width=N set output width (default: terminal width or
|
||||||
$COLUMNS). -wN,M sets description width as well.
|
$COLUMNS). -wN,M sets description width as well.
|
||||||
--align-all guarantee alignment across all lines (slower)
|
--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,
|
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.
|
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,
|
However, when reporting in a language different from English,
|
||||||
it is easier to omit this header and prepend your own one.
|
it is easier to omit this heading and prepend your own one.
|
||||||
For this purpose, use the `--header=no` option.
|
For this purpose, use the `--heading=no` option.
|
||||||
|
|
||||||
This command also supports the
|
This command also supports the
|
||||||
[output destination](hledger.html#output-destination) and
|
[output destination](hledger.html#output-destination) and
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user