cli: doc: queries: clarifications, especially not:

This commit is contained in:
Simon Michael 2017-09-07 08:35:53 -07:00
parent 75df6e0277
commit 81d7d3f709
4 changed files with 335 additions and 338 deletions

View File

@ -937,12 +937,12 @@ Most commands accept an optional query expression, written as arguments
after the command name, to filter the data by date, account name or after the command name, to filter the data by date, account name or
other criteria. other criteria.
The syntax is similar to a web search: one or more space\-separated The syntax is similar to a web search: one or more space\-separated
search terms, quotes to enclose whitespace, optional prefixes to match search terms, quotes to enclose whitespace, prefixes to match specific
specific fields. fields, a not: prefix to negate the match.
Multiple search terms are combined as follows:
.PP .PP
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
.IP \[bu] 2 .IP \[bu] 2
any of the description terms AND any of the description terms AND
.IP \[bu] 2 .IP \[bu] 2
@ -952,7 +952,7 @@ any of the status terms AND
.IP \[bu] 2 .IP \[bu] 2
all the other terms. all the other terms.
.PP .PP
The print command: show transactions which The print command instead shows transactions which:
.IP \[bu] 2 .IP \[bu] 2
match any of the description terms AND match any of the description terms AND
.IP \[bu] 2 .IP \[bu] 2
@ -962,10 +962,13 @@ have no postings matching any of the negative account terms AND
.IP \[bu] 2 .IP \[bu] 2
match all the other terms. match all the other terms.
.PP .PP
The following kinds of search terms can be used: The following kinds of search terms can be used.
Remember these can also be prefixed with \f[B]\f[C]not:\f[]\f[], eg to
exclude a particular subaccount.
.TP .TP
.B \f[B]\f[C]REGEX\f[]\f[] .B \f[B]\f[C]REGEX\f[]\f[]
match account names by this regular expression match account names by this regular expression.
(No prefix is equivalent to \f[C]acct:\f[]).
.RS .RS
.RE .RE
.TP .TP
@ -1057,18 +1060,13 @@ Also remember that postings inherit the tags of their parent
transaction. transaction.
.RS .RS
.RE .RE
.TP .PP
.B \f[B]\f[C]not:\f[]\f[] The following special search term is used only you click an account name
before any of the above negates the match. in hledger\-web:
.RS
.RE
.TP .TP
.B \f[B]\f[C]inacct:ACCTNAME\f[]\f[] .B \f[B]\f[C]inacct:ACCTNAME\f[]\f[]
a special term used automatically when you click an account name in tells hledger\-web to show the transaction register for this account.
hledger\-web, specifying the account register we are currently in Can be filtered further with \f[C]acct\f[] etc.
(selects the transactions of that account and how to show them, can be
filtered further with \f[C]acct\f[] etc).
Not supported elsewhere in hledger.
.RS .RS
.RE .RE
.PP .PP

View File

@ -666,29 +666,32 @@ subsets of your data. Most commands accept an optional query
expression, written as arguments after the command name, to filter the expression, written as arguments after the command name, to filter the
data by date, account name or other criteria. The syntax is similar to data by date, account name or other criteria. The syntax is similar to
a web search: one or more space-separated search terms, quotes to a web search: one or more space-separated search terms, quotes to
enclose whitespace, optional prefixes to match specific fields. enclose whitespace, prefixes to match specific fields, a not: prefix to
Multiple search terms are combined as follows: negate the match.
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
* any of the description terms AND * any of the description terms AND
* any of the account terms AND * any of the account terms AND
* any of the status terms AND * any of the status terms AND
* all the other terms. * all the other terms.
The print command: show transactions which The print command instead shows 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.
The following kinds of search terms can be used: The following kinds of search terms can be used. Remember these can
also be prefixed with *'not:'*, eg to exclude a particular subaccount.
*'REGEX'* *'REGEX'*
match account names by this regular expression match account names by this regular expression. (No prefix is
equivalent to 'acct:').
*'acct:REGEX'* *'acct:REGEX'*
same as above same as above
@ -749,16 +752,14 @@ match (or negatively match)
query is considered to match a transaction if it matches any of the query is considered to match a transaction if it matches any of the
postings. Also remember that postings inherit the tags of their postings. Also remember that postings inherit the tags of their
parent transaction. parent transaction.
*'not:'*
before any of the above negates the match. The following special search term is used only you click an account
name in hledger-web:
*'inacct:ACCTNAME'* *'inacct:ACCTNAME'*
a special term used automatically when you click an account name in tells hledger-web to show the transaction register for this
hledger-web, specifying the account register we are currently in account. Can be filtered further with 'acct' etc.
(selects the transactions of that account and how to show them, can
be filtered further with 'acct' etc). Not supported elsewhere in
hledger.
Some of these can also be expressed as command-line options (eg Some of these can also be expressed as command-line options (eg
'depth:2' is equivalent to '--depth 2'). Generally you can mix options 'depth:2' is equivalent to '--depth 2'). Generally you can mix options
@ -2162,95 +2163,95 @@ Node: Regular expressions19999
Ref: #regular-expressions20137 Ref: #regular-expressions20137
Node: QUERIES21498 Node: QUERIES21498
Ref: #queries21602 Ref: #queries21602
Node: COMMANDS25534 Node: COMMANDS25580
Ref: #commands25648 Ref: #commands25694
Node: accounts26327 Node: accounts26373
Ref: #accounts26427 Ref: #accounts26473
Node: activity27409 Node: activity27455
Ref: #activity27521 Ref: #activity27567
Node: add27880 Node: add27926
Ref: #add27981 Ref: #add28027
Node: balance30639 Node: balance30685
Ref: #balance30752 Ref: #balance30798
Node: Flat mode33767 Node: Flat mode33813
Ref: #flat-mode33894 Ref: #flat-mode33940
Node: Depth limited balance reports34314 Node: Depth limited balance reports34360
Ref: #depth-limited-balance-reports34517 Ref: #depth-limited-balance-reports34563
Node: Multicolumn balance reports34937 Node: Multicolumn balance reports34983
Ref: #multicolumn-balance-reports35148 Ref: #multicolumn-balance-reports35194
Node: Custom balance output39796 Node: Custom balance output39842
Ref: #custom-balance-output39980 Ref: #custom-balance-output40026
Node: Colour support42073 Node: Colour support42119
Ref: #colour-support42234 Ref: #colour-support42280
Node: Output destination42407 Node: Output destination42453
Ref: #output-destination42565 Ref: #output-destination42611
Node: CSV output42835 Node: CSV output42881
Ref: #csv-output42954 Ref: #csv-output43000
Node: balancesheet43351 Node: balancesheet43397
Ref: #balancesheet43489 Ref: #balancesheet43535
Node: balancesheetequity45396 Node: balancesheetequity45442
Ref: #balancesheetequity45547 Ref: #balancesheetequity45593
Node: cashflow46336 Node: cashflow46382
Ref: #cashflow46459 Ref: #cashflow46505
Node: help48310 Node: help48356
Ref: #help48422 Ref: #help48468
Node: incomestatement49496 Node: incomestatement49542
Ref: #incomestatement49627 Ref: #incomestatement49673
Node: print51519 Node: print51565
Ref: #print51636 Ref: #print51682
Node: register55392 Node: register55438
Ref: #register55505 Ref: #register55551
Node: Custom register output60001 Node: Custom register output60047
Ref: #custom-register-output60132 Ref: #custom-register-output60178
Node: stats61429 Node: stats61475
Ref: #stats61535 Ref: #stats61581
Node: test62416 Node: test62462
Ref: #test62503 Ref: #test62549
Node: ADD-ON COMMANDS62871 Node: ADD-ON COMMANDS62917
Ref: #add-on-commands62983 Ref: #add-on-commands63029
Node: Official add-ons64270 Node: Official add-ons64316
Ref: #official-add-ons64412 Ref: #official-add-ons64458
Node: api64499 Node: api64545
Ref: #api64590 Ref: #api64636
Node: ui64642 Node: ui64688
Ref: #ui64743 Ref: #ui64789
Node: web64801 Node: web64847
Ref: #web64892 Ref: #web64938
Node: Third party add-ons64938 Node: Third party add-ons64984
Ref: #third-party-add-ons65115 Ref: #third-party-add-ons65161
Node: diff65250 Node: diff65296
Ref: #diff65349 Ref: #diff65395
Node: iadd65448 Node: iadd65494
Ref: #iadd65564 Ref: #iadd65610
Node: interest65647 Node: interest65693
Ref: #interest65770 Ref: #interest65816
Node: irr65865 Node: irr65911
Ref: #irr65965 Ref: #irr66011
Node: Experimental add-ons66043 Node: Experimental add-ons66089
Ref: #experimental-add-ons66197 Ref: #experimental-add-ons66243
Node: autosync66599 Node: autosync66645
Ref: #autosync66713 Ref: #autosync66759
Node: budget66952 Node: budget66998
Ref: #budget67076 Ref: #budget67122
Node: chart67142 Node: chart67188
Ref: #chart67261 Ref: #chart67307
Node: check67332 Node: check67378
Ref: #check67456 Ref: #check67502
Node: check-dates67523 Node: check-dates67569
Ref: #check-dates67665 Ref: #check-dates67711
Node: check-dupes67738 Node: check-dupes67784
Ref: #check-dupes67881 Ref: #check-dupes67927
Node: equity67958 Node: equity68004
Ref: #equity68086 Ref: #equity68132
Node: prices68205 Node: prices68251
Ref: #prices68334 Ref: #prices68380
Node: print-unique68389 Node: print-unique68435
Ref: #print-unique68538 Ref: #print-unique68584
Node: register-match68631 Node: register-match68677
Ref: #register-match68787 Ref: #register-match68833
Node: rewrite68885 Node: rewrite68931
Ref: #rewrite69019 Ref: #rewrite69065
Node: tags69097 Node: tags69143
Ref: #tags69202 Ref: #tags69248
 
End Tag Table End Tag Table

View File

@ -605,11 +605,12 @@ QUERIES
sion, written as arguments after the command name, to filter the data sion, written as arguments after the command name, to filter the data
by date, account name or other criteria. The syntax is similar to a by date, account name or other criteria. The syntax is similar to a
web search: one or more space-separated search terms, quotes to enclose web search: one or more space-separated search terms, quotes to enclose
whitespace, optional prefixes to match specific fields. Multiple whitespace, prefixes to match specific fields, a not: prefix to negate
search terms are combined as follows: the match.
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
o any of the description terms AND o any of the description terms AND
@ -619,7 +620,7 @@ QUERIES
o all the other terms. o all the other terms.
The print command: show transactions which The print command instead shows transactions which:
o match any of the description terms AND o match any of the description terms AND
@ -629,9 +630,11 @@ QUERIES
o match all the other terms. o match all the other terms.
The following kinds of search terms can be used: The following kinds of search terms can be used. Remember these can
also be prefixed with not:, eg to exclude a particular subaccount.
REGEX match account names by this regular expression REGEX match account names by this regular expression. (No prefix is
equivalent to acct:).
acct:REGEX acct:REGEX
same as above same as above
@ -693,14 +696,12 @@ QUERIES
any of the postings. Also remember that postings inherit the any of the postings. Also remember that postings inherit the
tags of their parent transaction. tags of their parent transaction.
not: before any of the above negates the match. The following special search term is used only you click an account
name in hledger-web:
inacct:ACCTNAME inacct:ACCTNAME
a special term used automatically when you click an account name tells hledger-web to show the transaction register for this
in hledger-web, specifying the account register we are currently account. Can be filtered further with acct etc.
in (selects the transactions of that account and how to show
them, can be filtered further with acct etc). Not supported
elsewhere in hledger.
Some of these can also be expressed as command-line options (eg depth:2 Some of these can also be expressed as command-line options (eg depth:2
is equivalent to --depth 2). Generally you can mix options and query is equivalent to --depth 2). Generally you can mix options and query

View File

@ -6,29 +6,29 @@ to filter the data by date, account name or other criteria.
The syntax is similar to a web search: The syntax is similar to a web search:
one or more space-separated search terms, one or more space-separated search terms,
quotes to enclose whitespace, quotes to enclose whitespace,
optional prefixes to match specific fields. prefixes to match specific fields,
Multiple search terms are combined as follows: a not: prefix to negate the match.
All commands except print: We do not yet support arbitrary boolean combinations of search terms;
show transactions/postings/accounts which match (or negatively match) instead most commands show transactions/postings/accounts which match (or negatively match):
- any of the description terms AND - any of the description terms AND
- any of the account terms AND - any of the account terms AND
- any of the status terms AND - any of the status terms AND
- all the other terms. - all the other terms.
The print command: The [print](/manual.html#print) command instead shows transactions which:
show 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.
The following kinds of search terms can be used: The following kinds of search terms can be used.
Remember these can also be prefixed with **`not:`**, eg to exclude a particular subaccount.
**`REGEX`** **`REGEX`**
: match account names by this regular expression : match account names by this regular expression. (No prefix is equivalent to `acct:`).
**`acct:REGEX`** **`acct:REGEX`**
: same as above : same as above
@ -88,14 +88,11 @@ tag: query is considered to match a transaction if it matches any of
the postings. Also remember that postings inherit the tags of their the postings. Also remember that postings inherit the tags of their
parent transaction. parent transaction.
**`not:`** The following special search term is used only you click an account name in hledger-web:
: before any of the above negates the match.
**`inacct:ACCTNAME`** **`inacct:ACCTNAME`**
: a special term used automatically when you click an account name in hledger-web, : tells hledger-web to show the transaction register for this account.
specifying the account register we are currently in Can be filtered further with `acct` etc.
(selects the transactions of that account and how to show them, can be filtered further with `acct` etc).
Not supported elsewhere in hledger.
Some of these can also be expressed as command-line options (eg `depth:2` is equivalent to `--depth 2`). Some of these can also be expressed as command-line options (eg `depth:2` is equivalent to `--depth 2`).
Generally you can mix options and query arguments, and the resulting query will be their intersection Generally you can mix options and query arguments, and the resulting query will be their intersection