diff --git a/doc/manual.md b/doc/manual.md index b3c0fb1a3..125cfab7e 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -137,9 +137,13 @@ Now let's explore the available journal file syntax in detail. Each journal entry begins with a [simple date](#simple-dates) in column 0, followed by three optional fields with spaces between them: -a status flag (`*` or `!` or nothing), a transaction code (eg a check -number), and/or a description; then two or more postings (of some -amount to some account), each on their own line. + +- a status flag, which can be empty or `!` or `*` (meaning "uncleared", "pending" and "cleared", or whatever you want) +- a transaction code (eg a check number), +- and/or a description + +then two or more postings (of some amount to some account), each on +their own line. The posting amounts within a transaction must always balance, ie add up to 0. You can leave one amount blank and it will be inferred. @@ -852,7 +856,7 @@ A query term can be any of the following: - `date2:PERIODEXPR` - as above, but match secondary dates - `tag:NAME[=REGEX]` - match by (exact, case sensitive) [tag](#tags) name, and optionally match the tag value by regular expression. Note `tag:` will match a transaction if it or any its postings have the tag, and will match posting if it or its parent transaction has the tag. - `depth:N` - match (or display, depending on command) accounts at or above this [depth](#depth-limiting) -- `status:1` or `status:0` - match cleared/uncleared transactions +- `status:1` or `status:0` - match pending/cleared or uncleared transactions respectively - `real:1` or `real:0` - match real/virtual-ness - `empty:1` or `empty:0` - match if amount is/is not zero - `amt:N`, `amt:N`, `amt:>=N` - match postings with a single-commodity diff --git a/hledger-lib/Hledger/Query.hs b/hledger-lib/Hledger/Query.hs index 022c72a0f..b2bb895e6 100644 --- a/hledger-lib/Hledger/Query.hs +++ b/hledger-lib/Hledger/Query.hs @@ -331,18 +331,18 @@ parseTag s | '=' `elem` s = (n, Just $ tail v) | otherwise = (s, Nothing) where (n,v) = break (=='=') s --- | Parse the boolean value part of a "status:" query, allowing "*" as --- another way to spell True, similar to the journal file format. +-- -- , treating "*" or "!" as synonyms for "1". +-- | Parse the boolean value part of a "status:" query. parseStatus :: String -> Bool -parseStatus s = s `elem` (truestrings ++ ["*"]) +parseStatus s = s `elem` (truestrings) -- ++ ["*","!"]) --- | Parse the boolean value part of a "status:" query. A true value can --- be spelled as "1", "t" or "true". +-- | Parse the boolean value part of a "status:" query. "1" means true, +-- anything else will be parsed as false without error. parseBool :: String -> Bool parseBool s = s `elem` truestrings truestrings :: [String] -truestrings = ["1","t","true"] +truestrings = ["1"] simplifyQuery :: Query -> Query simplifyQuery q = diff --git a/hledger/Hledger/Cli/Options.hs b/hledger/Hledger/Cli/Options.hs index ad15697c9..0705cd2b2 100644 --- a/hledger/Hledger/Cli/Options.hs +++ b/hledger/Hledger/Cli/Options.hs @@ -120,7 +120,7 @@ reportflags = [ ,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or reporting interval all at once (overrides the flags above)" ,flagNone ["date2","aux-date"] (setboolopt "date2") "use postings/txns' secondary dates instead" - ,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns" + ,flagNone ["cleared","C"] (setboolopt "cleared") "include only pending/cleared postings/txns" ,flagNone ["uncleared","U"] (setboolopt "uncleared") "include only uncleared postings/txns" ,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings" ,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "N" "hide accounts/postings deeper than N"