diff --git a/Ledger/Parse.hs b/Ledger/Parse.hs index 4d96f7a77..a6848c1ba 100644 --- a/Ledger/Parse.hs +++ b/Ledger/Parse.hs @@ -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 - diff --git a/Options.hs b/Options.hs index 687140fff..27fcaf112 100644 --- a/Options.hs +++ b/Options.hs @@ -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", diff --git a/README b/README index deac660c3..153c7610f 100644 --- a/README +++ b/README @@ -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 diff --git a/Tests.hs b/Tests.hs index ca96c099b..a4529c9df 100644 --- a/Tests.hs +++ b/Tests.hs @@ -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 ] ------------------------------------------------------------------------------