ui: set report period from date: query args, also
date2: and --date2 might also affect it somehow, untested.
This commit is contained in:
parent
9df96cdace
commit
1d6ca47536
@ -76,16 +76,17 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
uopts' = uopts{
|
uopts' = uopts{
|
||||||
cliopts_=copts{
|
cliopts_=copts{
|
||||||
reportopts_= ropts{
|
reportopts_= ropts{
|
||||||
-- ensure depth_ also reflects depth: args
|
-- incorporate any depth: query args into depth_,
|
||||||
depth_=depthfromoptsandargs,
|
-- any date: query args into period_
|
||||||
-- remove depth: args from query_
|
depth_ =depthfromoptsandargs,
|
||||||
query_=unwords $ -- as in ReportOptions, with same limitations
|
period_=periodfromoptsandargs,
|
||||||
[v | (k,v) <- rawopts_ copts, k=="args", not $ "depth" `isPrefixOf` v],
|
query_ =unwords -- as in ReportOptions, with same limitations
|
||||||
-- show items with zero amount by default, unlike the CLI
|
[v | (k,v) <- rawopts_ copts, k=="args", not $ any (`isPrefixOf` v) ["depth","date"]],
|
||||||
empty_=True,
|
|
||||||
-- always disable boring account name eliding, unlike the CLI, for a more regular tree
|
-- always disable boring account name eliding, unlike the CLI, for a more regular tree
|
||||||
no_elide_=True,
|
no_elide_=True,
|
||||||
-- always show historical balances, regardless of report start date
|
-- show items with zero amount by default, unlike the CLI
|
||||||
|
empty_=True,
|
||||||
|
-- show historical balances by default, unlike the CLI
|
||||||
balancetype_=HistoricalBalance
|
balancetype_=HistoricalBalance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,6 +95,9 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
q = queryFromOpts d ropts
|
q = queryFromOpts d ropts
|
||||||
depthfromoptsandargs = case queryDepth q of 99999 -> Nothing
|
depthfromoptsandargs = case queryDepth q of 99999 -> Nothing
|
||||||
d -> Just d
|
d -> Just d
|
||||||
|
datespanfromargs = queryDateSpan (date2_ ropts) $ fst $ parseQuery d (T.pack $ query_ ropts)
|
||||||
|
periodfromoptsandargs =
|
||||||
|
dateSpanAsPeriod $ spansIntersect [periodAsDateSpan $ period_ ropts, datespanfromargs]
|
||||||
|
|
||||||
-- XXX move this stuff into Options, UIOpts
|
-- XXX move this stuff into Options, UIOpts
|
||||||
theme = maybe defaultTheme (fromMaybe defaultTheme . getTheme) $
|
theme = maybe defaultTheme (fromMaybe defaultTheme . getTheme) $
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user