docs: polish query docs

This commit is contained in:
Simon Michael 2012-05-28 00:56:23 +00:00
parent f923789003
commit 8b961b2c8f

View File

@ -876,26 +876,26 @@ reporting. They are common to most commands, where applicable.
### Queries ### Queries
Most commands accept an optional query expression, written as arguments Most commands accept an optional query expression, written as arguments
after the command name (or entered in the hledger-web search field), to after the command name, to filter the data (or in some cases, to modify
filter the data. The syntax is similar a Google search expression: one or the output). The syntax is similar to a Google search expression: one or
more space separated search terms, optional prefixes to match specific more space-separated search terms, optional prefixes to match specific
fields, quotes to enclose whitespace etc. Here are the kinds of query term fields, quotes to enclose whitespace etc. Each query term can be any of
currently supported: the following:
- `REGEX` (no prefix) - match account names by this regular expression - `REGEX` - match account names by this regular expression
- `acct:REGEX` - same as above - `acct:REGEX` - same as above
- `desc:REGEX` - match transaction descriptions by regular expression - `desc:REGEX` - match transaction descriptions by regular expression
- `date:PERIODEXPR` - match dates within the specified [period] (which may not contain a reporting interval) - `date:PERIODEXPR` - match dates within the specified [period](#period-expressions) (which may not contain a reporting interval)
- `edate:DATEEXPR` - as above, but match the effective date - `edate:PERIODEXPR` - as above, but match effective dates
- `status:1` or `status:0` - match cleared/uncleared transactions - `status:1` or `status:0` - match cleared/uncleared transactions
- `tag:NAME[=REGEX]` - match by exact [tag](#tags) name, and optionally match the tag value by regular expression
- `depth:N` - match (or display, depending on command) accounts at or above this depth - `depth:N` - match (or display, depending on command) accounts at or above this depth
- `not:` before any of the above negates the match - `not:` before any of the above negates the match
- `tag:NAME[=VALUEREGEX]` - match by exact [tag](#tags) name, and optionally match the tag value by regular expression
<!-- <!--
- `TAGNAME:[TAGVALUEREGEX]` - match a tag name exactly, and optionally - `TAGNAME:[TAGVALUEREGEX]` - match a tag name exactly, and optionally
the value by regular expression. the value by regular expression.
- `code:CODEREGEX` --> - `code:CODEREGEX`
- `type:regular|virtual|balancedvirtual` - `type:regular|virtual|balancedvirtual`
- `comment:COMMENTREGEX` - `comment:COMMENTREGEX`
- `amount:AMOUNTEXPR` - `amount:AMOUNTEXPR`
@ -903,23 +903,23 @@ currently supported:
Any of these can be prefixed with `not:` or `!` to negate the match. Any of these can be prefixed with `not:` or `!` to negate the match.
--> -->
Note these query terms can also be expressed as command-line flags; you Multiple query terms will select transactions/postings/accounts which match
can use either, or both. (or negatively match)
With multiple query terms, most commands select the > *any of the description terms AND*
transactions/postings/accounts which match (or negatively match) > *any of the account terms AND*
> *any of the account terms* AND
> *any of the description terms* AND
> *all the other terms* > *all the other terms*
The [print](#print) command selects transactions which With the [print](#print) command, they select transactions which
> *match any of the description terms* AND > *match any of the description terms AND*
> *have any postings matching any of the positive account terms* AND > *have any postings matching any of the positive account terms AND*
> *have no postings matching any of the negative account terms* AND > *have no postings matching any of the negative account terms AND*
> *match all the other terms* > *match all the other terms*
Note many of the above query terms can also be expressed as command-line
flags; you can use either, or both at once.
### Smart dates ### Smart dates
Unlike the journal file, hledger's user interface accepts more flexible Unlike the journal file, hledger's user interface accepts more flexible