lib: Remove unused --display code.
This was dropped back in 2014, and getting rid of this removes a use of regular expressions.
This commit is contained in:
parent
8dfffb1e61
commit
20b39a5dd0
@ -373,7 +373,7 @@ tests_PostingsReport = tests "PostingsReport" [
|
|||||||
j <- samplejournal
|
j <- samplejournal
|
||||||
let gives displayexpr =
|
let gives displayexpr =
|
||||||
(registerdates (postingsReportAsText opts $ postingsReport opts (queryFromOpts date1 opts) j) `is`)
|
(registerdates (postingsReportAsText opts $ postingsReport opts (queryFromOpts date1 opts) j) `is`)
|
||||||
where opts = defreportopts{display_=Just displayexpr}
|
where opts = defreportopts
|
||||||
"d<[2008/6/2]" `gives` ["2008/01/01","2008/06/01"]
|
"d<[2008/6/2]" `gives` ["2008/01/01","2008/06/01"]
|
||||||
"d<=[2008/6/2]" `gives` ["2008/01/01","2008/06/01","2008/06/02"]
|
"d<=[2008/6/2]" `gives` ["2008/01/01","2008/06/01","2008/06/02"]
|
||||||
"d=[2008/6/2]" `gives` ["2008/06/02"]
|
"d=[2008/6/2]" `gives` ["2008/06/02"]
|
||||||
|
|||||||
@ -98,7 +98,6 @@ data ReportOpts = ReportOpts {
|
|||||||
,value_ :: Maybe ValuationType -- ^ What value should amounts be converted to ?
|
,value_ :: Maybe ValuationType -- ^ What value should amounts be converted to ?
|
||||||
,infer_value_ :: Bool -- ^ Infer market prices from transactions ?
|
,infer_value_ :: Bool -- ^ Infer market prices from transactions ?
|
||||||
,depth_ :: Maybe Int
|
,depth_ :: Maybe Int
|
||||||
,display_ :: Maybe DisplayExp -- XXX unused ?
|
|
||||||
,date2_ :: Bool
|
,date2_ :: Bool
|
||||||
,empty_ :: Bool
|
,empty_ :: Bool
|
||||||
,no_elide_ :: Bool
|
,no_elide_ :: Bool
|
||||||
@ -172,7 +171,6 @@ defreportopts = ReportOpts
|
|||||||
def
|
def
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
def
|
|
||||||
|
|
||||||
rawOptsToReportOpts :: RawOpts -> IO ReportOpts
|
rawOptsToReportOpts :: RawOpts -> IO ReportOpts
|
||||||
rawOptsToReportOpts rawopts = checkReportOpts <$> do
|
rawOptsToReportOpts rawopts = checkReportOpts <$> do
|
||||||
@ -189,7 +187,6 @@ rawOptsToReportOpts rawopts = checkReportOpts <$> do
|
|||||||
,value_ = valuationTypeFromRawOpts rawopts'
|
,value_ = valuationTypeFromRawOpts rawopts'
|
||||||
,infer_value_ = boolopt "infer-value" rawopts'
|
,infer_value_ = boolopt "infer-value" rawopts'
|
||||||
,depth_ = maybeposintopt "depth" rawopts'
|
,depth_ = maybeposintopt "depth" rawopts'
|
||||||
,display_ = maybedisplayopt d rawopts'
|
|
||||||
,date2_ = boolopt "date2" rawopts'
|
,date2_ = boolopt "date2" rawopts'
|
||||||
,empty_ = boolopt "empty" rawopts'
|
,empty_ = boolopt "empty" rawopts'
|
||||||
,no_elide_ = boolopt "no-elide" rawopts'
|
,no_elide_ = boolopt "no-elide" rawopts'
|
||||||
@ -416,15 +413,6 @@ valuationTypeIsDefaultValue ropts =
|
|||||||
Just (AtDefault _) -> True
|
Just (AtDefault _) -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
|
|
||||||
type DisplayExp = String
|
|
||||||
|
|
||||||
maybedisplayopt :: Day -> RawOpts -> Maybe DisplayExp
|
|
||||||
maybedisplayopt d rawopts =
|
|
||||||
maybe Nothing (Just . replaceAllBy (toRegex' "\\[.+?\\]") fixbracketeddatestr) $ maybestringopt "display" rawopts
|
|
||||||
where
|
|
||||||
fixbracketeddatestr "" = ""
|
|
||||||
fixbracketeddatestr s = "[" ++ fixSmartDateStr d (T.pack $ init $ tail s) ++ "]"
|
|
||||||
|
|
||||||
-- | Select the Transaction date accessor based on --date2.
|
-- | Select the Transaction date accessor based on --date2.
|
||||||
transactionDateFn :: ReportOpts -> (Transaction -> Day)
|
transactionDateFn :: ReportOpts -> (Transaction -> Day)
|
||||||
transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate
|
transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user