correction, dates in display expressions should be in brackets

This commit is contained in:
Simon Michael 2008-11-25 18:47:26 +00:00
parent 0582046648
commit 33b2deba75
4 changed files with 8 additions and 8 deletions

View File

@ -539,15 +539,15 @@ smartparsedate :: String -> Date
smartparsedate s = parsedate $ printf "%04s/%02s/%02s" y m d
where (y,m,d) = fromparse $ parsewith smartdate s
-- | Parse a --display expression of the form "d>DATE"
type TransactionMatcher = Transaction -> Bool
-- | Parse a --display expression of the form "d>[DATE]"
datedisplayexpr :: Parser TransactionMatcher
datedisplayexpr = do
char 'd'
char '>'
char '['
(y,m,d) <- smartdate
char ']'
let edate = parsedate $ printf "%04s/%02s/%02s" y m d
return $ \(Transaction{date=tdate}) -> tdate > edate

View File

@ -37,7 +37,7 @@ options = [
Option ['C'] ["cleared"] (NoArg Cleared) "report only on cleared entries",
Option ['B'] ["cost","basis"] (NoArg CostBasis) "report cost basis of commodities",
Option [] ["depth"] (ReqArg Depth "N") "balance report: maximum account depth to show",
Option ['d'] ["display"] (ReqArg Display "EXPR") "display only transactions matching EXPR\n(where EXPR is 'd>Y/M/D')",
Option ['d'] ["display"] (ReqArg Display "EXPR") "display only transactions matching EXPR\n(where EXPR is 'd>[Y/M/D]')",
Option ['E'] ["empty"] (NoArg Empty) "balance report: show accounts with zero balance",
Option ['R'] ["real"] (NoArg Real) "report only on real (non-virtual) transactions",
Option ['n'] ["collapse"] (NoArg Collapse) "balance report: no grand total",

6
README
View File

@ -63,9 +63,10 @@ This version of hledger mimics a subset of ledger 2.6.1:
-R, --real consider only real (non-virtual) transactions
Output customization:
-s, --subtotal balance report: show sub-accounts
-E, --empty balance report: show accounts with zero balance
-n, --collapse balance report: no grand total
-d, --display EXPR display only transactions matching EXPR (limited support)
-E, --empty balance report: show accounts with zero balance
-s, --subtotal balance report: show sub-accounts
Commodity reporting:
-B, --basis, --cost report cost basis of commodities
@ -132,7 +133,6 @@ ledger features not supported:
--totals in the "xml" report, include running total
-j, --amount-data print only raw amount data (useful for scripting)
-J, --total-data print only raw total data
-d, --display EXPR display only transactions matching EXPR
-y, --date-format STR use STR as the date format (default: %Y/%m/%d)
-F, --format STR use STR as the format; for each report type, use:
--balance-format --register-format --print-format

View File

@ -323,7 +323,7 @@ registercommand_tests = TestList [
"2008/01/01 pay off liabilities:debts $1 $1\n" ++
" assets:checking $-1 0\n" ++
"")
$ showRegisterReport [Display "d>2007/12"] [] l
$ showRegisterReport [Display "d>[2007/12]"] [] l
]
------------------------------------------------------------------------------