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