tighten up status: docs and behaviour a bit (fix #227)
A status: query term no longer accepts * as a synonym for 1, which was a bit confusing since 1 matches both * and !. For now, it takes a value of 1 (true) or anything else (false).
This commit is contained in:
		
							parent
							
								
									c138c35d3b
								
							
						
					
					
						commit
						62bad65e5b
					
				| @ -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`, `amt:>N`, `amt:>=N` - match postings with a single-commodity | ||||
|  | ||||
| @ -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 = | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user