add -D/--daily flag
This commit is contained in:
parent
ff6b979816
commit
56226d72e6
@ -87,6 +87,7 @@ options = [
|
||||
,Option "" ["flat"] (NoArg Flat) "balance: show full account names, unindented"
|
||||
,Option "" ["drop"] (ReqArg Drop "N") "balance: with --flat, elide first N account name components"
|
||||
,Option "" ["no-total"] (NoArg NoTotal) "balance: hide the final total"
|
||||
,Option "D" ["daily"] (NoArg DailyOpt) "register, stats: report by day"
|
||||
,Option "W" ["weekly"] (NoArg WeeklyOpt) "register, stats: report by week"
|
||||
,Option "M" ["monthly"] (NoArg MonthlyOpt) "register, stats: report by month"
|
||||
,Option "Q" ["quarterly"] (NoArg QuarterlyOpt) "register, stats: report by quarter"
|
||||
@ -131,6 +132,7 @@ data Opt =
|
||||
Drop {value::String} |
|
||||
NoTotal |
|
||||
SubTotal |
|
||||
DailyOpt |
|
||||
WeeklyOpt |
|
||||
MonthlyOpt |
|
||||
QuarterlyOpt |
|
||||
@ -215,6 +217,7 @@ intervalFromOpts :: [Opt] -> Interval
|
||||
intervalFromOpts opts =
|
||||
case (periodopts, intervalopts) of
|
||||
((p:_), _) -> fst $ parsePeriodExpr d p where d = parsedate "0001/01/01" -- unused
|
||||
(_, (DailyOpt:_)) -> Daily
|
||||
(_, (WeeklyOpt:_)) -> Weekly
|
||||
(_, (MonthlyOpt:_)) -> Monthly
|
||||
(_, (QuarterlyOpt:_)) -> Quarterly
|
||||
@ -222,7 +225,7 @@ intervalFromOpts opts =
|
||||
(_, _) -> NoInterval
|
||||
where
|
||||
periodopts = reverse $ optValuesForConstructor Period opts
|
||||
intervalopts = reverse $ filter (`elem` [WeeklyOpt,MonthlyOpt,QuarterlyOpt,YearlyOpt]) opts
|
||||
intervalopts = reverse $ filter (`elem` [DailyOpt,WeeklyOpt,MonthlyOpt,QuarterlyOpt,YearlyOpt]) opts
|
||||
|
||||
-- | Get the value of the (last) depth option, if any.
|
||||
depthFromOpts :: [Opt] -> Maybe Int
|
||||
|
||||
@ -323,6 +323,7 @@ tests = TestList [
|
||||
,"intervalFromOpts" ~: do
|
||||
let gives = is . intervalFromOpts
|
||||
[] `gives` NoInterval
|
||||
[DailyOpt] `gives` Daily
|
||||
[WeeklyOpt] `gives` Weekly
|
||||
[MonthlyOpt] `gives` Monthly
|
||||
[QuarterlyOpt] `gives` Quarterly
|
||||
|
||||
@ -233,6 +233,7 @@ Here is the command-line help:
|
||||
--flat balance: show full account names, unindented
|
||||
--drop=N balance: with --flat, elide first N account name components
|
||||
--no-total balance: hide the final total
|
||||
-D --daily register, stats: report by day
|
||||
-W --weekly register, stats: report by week
|
||||
-M --monthly register, stats: report by month
|
||||
-Q --quarterly register, stats: report by quarter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user