print: help tweak

This commit is contained in:
Simon Michael 2017-09-15 09:55:38 -07:00
parent 669fa706c0
commit c79c8b9883
5 changed files with 175 additions and 103 deletions

View File

@ -37,7 +37,7 @@ printmode = (defCommandMode $ ["print"] ++ aliases) {
,flagNone ["explicit","x"] (setboolopt "explicit") ,flagNone ["explicit","x"] (setboolopt "explicit")
"show all amounts explicitly" "show all amounts explicitly"
,flagNone ["new"] (setboolopt "new") ,flagNone ["new"] (setboolopt "new")
"show only more recent transactions added to each file since last run" "show only newer-dated transactions added in each file since last run"
] ]
++ outputflags ++ outputflags
,groupHidden = [] ,groupHidden = []

View File

@ -468,7 +468,7 @@ Show transactions from the journal. Aliases: p, txns.
: show the transaction whose description is most similar to STR, and is most recent : show the transaction whose description is most similar to STR, and is most recent
` --new` ` --new`
: show only more recent transactions added to each file since last run : show only newer-dated transactions added in each file since last run
`-x --explicit` `-x --explicit`
: show all amounts explicitly : show all amounts explicitly

View File

@ -2058,17 +2058,22 @@ Print all market prices from the journal.
Show transactions from the journal. Show transactions from the journal.
Aliases: p, txns. Aliases: p, txns.
.TP .TP
.B \f[C]\-x\ \ \ \ \ \-\-explicit\f[]
show all amounts explicitly
.RS
.RE
.TP
.B \f[C]\-m\ STR\ \-\-match=STR\f[] .B \f[C]\-m\ STR\ \-\-match=STR\f[]
show the transaction whose description is most similar to STR, and is show the transaction whose description is most similar to STR, and is
most recent most recent
.RS .RS
.RE .RE
.TP .TP
.B \f[C]\-\-new\f[]
show only newer\-dated transactions added in each file since last run
.RS
.RE
.TP
.B \f[C]\-x\ \ \ \ \ \-\-explicit\f[]
show all amounts explicitly
.RS
.RE
.TP
.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[] .B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]
select the output format. select the output format.
Supported formats: txt, csv. Supported formats: txt, csv.
@ -2108,24 +2113,50 @@ $\ hledger\ print
.fi .fi
.PP .PP
The print command displays full journal entries (transactions) from the The print command displays full journal entries (transactions) from the
journal file, tidily formatted. journal file in date order, tidily formatted.
print\[aq]s output is always a valid hledger journal.
It preserves all transaction information, but it does not preserve
directives or inter\-transaction comments
.PP .PP
As of hledger 1.2, print\[aq]s output is always a valid hledger journal. Normally, the journal entry\[aq]s explicit or implicit amount style is
However it may not preserve all original content, eg it does not print preserved.
directives or inter\-transaction comments. Ie when an amount is omitted in the journal, it will be omitted in the
.PP
Normally, transactions\[aq] implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be omitted in the
output. output.
You can use the \f[C]\-x/\-\-explicit\f[] flag to make all amounts You can use the \f[C]\-x\f[]/\f[C]\-\-explicit\f[] flag to make all
explicit, which can be useful for troubleshooting or for making your amounts explicit, which can be useful for troubleshooting or for making
journal more readable and robust against data entry errors. your journal more readable and robust against data entry errors.
Note, in this mode postings with a multi\-commodity amount (possible Note, \f[C]\-x\f[] will cause postings with a multi\-commodity amount
with an implicit amount in a multi\-commodity transaction) will be split (these can arise when a multi\-commodity transaction has an implicit
into multiple single\-commodity postings, for valid journal output. amount) will be split into multiple single\-commodity postings, for
valid journal output.
.PP .PP
With \-B/\-\-cost, amounts with transaction prices are converted to cost With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are
(using the transaction price). converted to cost using that price.
.PP
With \f[C]\-m\f[]/\f[C]\-\-match\f[] and a STR argument, print will show
at most one transaction: the one one whose description is most similar
to STR, and is most recent.
STR should contain at least two characters.
If there is no similar\-enough match, no transaction will be shown.
.PP
With \f[C]\-\-new\f[], for each FILE being read, hledger reads (and
writes) a special .FILE.seen file in the same directory, containing the
latest transaction date(s) that were seen last time FILE was read.
When this file is found, only transactions with newer dates (and new
transactions on the latest date) are printed.
This is useful for ignoring already\-seen entries in import data, such
as downloaded CSV files.
Eg:
.IP
.nf
\f[C]
$\ hledger\ \-f\ bank1.csv\ print\ \-\-new
#\ shows\ transactions\ added\ since\ last\ print\ \-\-new\ on\ this\ file
\f[]
.fi
.PP
It assumes that only same\-or\-newer\-dated transactions are added to
FILE, and that the order of same\-date transactions remains stable.
.PP .PP
The print command also supports output destination and CSV output. The print command also supports output destination and CSV output.
Here\[aq]s an example of print\[aq]s CSV output: Here\[aq]s an example of print\[aq]s CSV output:

View File

@ -1648,13 +1648,17 @@ File: hledger.1.info, Node: print, Next: print-unique, Prev: prices, Up: COM
Show transactions from the journal. Aliases: p, txns. Show transactions from the journal. Aliases: p, txns.
'-x --explicit'
show all amounts explicitly
'-m STR --match=STR' '-m STR --match=STR'
show the transaction whose description is most similar to STR, and show the transaction whose description is most similar to STR, and
is most recent is most recent
'--new'
show only newer-dated transactions added in each file since last
run
'-x --explicit'
show all amounts explicitly
'-O FMT --output-format=FMT' '-O FMT --output-format=FMT'
select the output format. Supported formats: txt, csv. select the output format. Supported formats: txt, csv.
@ -1686,23 +1690,40 @@ $ hledger print
assets:bank:checking $-1 assets:bank:checking $-1
The print command displays full journal entries (transactions) from The print command displays full journal entries (transactions) from
the journal file, tidily formatted. the journal file in date order, tidily formatted. print's output is
always a valid hledger journal. It preserves all transaction
information, but it does not preserve directives or inter-transaction
comments
As of hledger 1.2, print's output is always a valid hledger journal. Normally, the journal entry's explicit or implicit amount style is
However it may not preserve all original content, eg it does not print preserved. Ie when an amount is omitted in the journal, it will be
directives or inter-transaction comments. omitted in the output. You can use the '-x'/'--explicit' flag to make
all amounts explicit, which can be useful for troubleshooting or for
making your journal more readable and robust against data entry errors.
Note, '-x' will cause postings with a multi-commodity amount (these can
arise when a multi-commodity transaction has an implicit amount) will be
split into multiple single-commodity postings, for valid journal output.
Normally, transactions' implicit/explicit amount style is preserved: With '-B'/'--cost', amounts with transaction prices are converted to
when an amount is omitted in the journal, it will be omitted in the cost using that price.
output. You can use the '-x/--explicit' flag to make all amounts
explicit, which can be useful for troubleshooting or for making your
journal more readable and robust against data entry errors. Note, in
this mode postings with a multi-commodity amount (possible with an
implicit amount in a multi-commodity transaction) will be split into
multiple single-commodity postings, for valid journal output.
With -B/-cost, amounts with transaction prices are converted to cost With '-m'/'--match' and a STR argument, print will show at most one
(using the transaction price). transaction: the one one whose description is most similar to STR, and
is most recent. STR should contain at least two characters. If there
is no similar-enough match, no transaction will be shown.
With '--new', for each FILE being read, hledger reads (and writes) a
special .FILE.seen file in the same directory, containing the latest
transaction date(s) that were seen last time FILE was read. When this
file is found, only transactions with newer dates (and new transactions
on the latest date) are printed. This is useful for ignoring
already-seen entries in import data, such as downloaded CSV files. Eg:
$ hledger -f bank1.csv print --new
# shows transactions added since last print --new on this file
It assumes that only same-or-newer-dated transactions are added to
FILE, and that the order of same-date transactions remains stable.
The print command also supports output destination and CSV output. The print command also supports output destination and CSV output.
Here's an example of print's CSV output: Here's an example of print's CSV output:
@ -2212,51 +2233,51 @@ Node: prices52658
Ref: #prices52775 Ref: #prices52775
Node: print52818 Node: print52818
Ref: #print52930 Ref: #print52930
Node: print-unique56705 Node: print-unique57726
Ref: #print-unique56833 Ref: #print-unique57854
Node: register56901 Node: register57922
Ref: #register57030 Ref: #register58051
Node: Custom register output61531 Node: Custom register output62552
Ref: #custom-register-output61662 Ref: #custom-register-output62683
Node: register-match62959 Node: register-match63980
Ref: #register-match63095 Ref: #register-match64116
Node: rewrite63278 Node: rewrite64299
Ref: #rewrite63397 Ref: #rewrite64418
Node: stats63466 Node: stats64487
Ref: #stats63571 Ref: #stats64592
Node: tags64452 Node: tags65473
Ref: #tags64552 Ref: #tags65573
Node: test64584 Node: test65605
Ref: #test64670 Ref: #test65691
Node: ADD-ON COMMANDS65038 Node: ADD-ON COMMANDS66059
Ref: #add-on-commands65150 Ref: #add-on-commands66171
Node: Official add-ons66437 Node: Official add-ons67458
Ref: #official-add-ons66579 Ref: #official-add-ons67600
Node: api66666 Node: api67687
Ref: #api66757 Ref: #api67778
Node: ui66809 Node: ui67830
Ref: #ui66910 Ref: #ui67931
Node: web66968 Node: web67989
Ref: #web67059 Ref: #web68080
Node: Third party add-ons67105 Node: Third party add-ons68126
Ref: #third-party-add-ons67282 Ref: #third-party-add-ons68303
Node: diff67417 Node: diff68438
Ref: #diff67516 Ref: #diff68537
Node: iadd67615 Node: iadd68636
Ref: #iadd67731 Ref: #iadd68752
Node: interest67814 Node: interest68835
Ref: #interest67937 Ref: #interest68958
Node: irr68032 Node: irr69053
Ref: #irr68132 Ref: #irr69153
Node: Experimental add-ons68210 Node: Experimental add-ons69231
Ref: #experimental-add-ons68364 Ref: #experimental-add-ons69385
Node: autosync68655 Node: autosync69676
Ref: #autosync68769 Ref: #autosync69790
Node: budget69008 Node: budget70029
Ref: #budget69132 Ref: #budget70153
Node: chart69198 Node: chart70219
Ref: #chart69317 Ref: #chart70338
Node: check69388 Node: check70409
Ref: #check69492 Ref: #check70513
 
End Tag Table End Tag Table

View File

@ -1448,18 +1448,21 @@ COMMANDS
print print
Show transactions from the journal. Aliases: p, txns. Show transactions from the journal. Aliases: p, txns.
-x --explicit
show all amounts explicitly
-m STR --match=STR -m STR --match=STR
show the transaction whose description is most similar to STR, show the transaction whose description is most similar to STR,
and is most recent and is most recent
--new show only newer-dated transactions added in each file since last
run
-x --explicit
show all amounts explicitly
-O FMT --output-format=FMT -O FMT --output-format=FMT
select the output format. Supported formats: txt, csv. select the output format. Supported formats: txt, csv.
-o FILE --output-file=FILE -o FILE --output-file=FILE
write output to FILE. A file extension matching one of the write output to FILE. A file extension matching one of the
above formats selects that format. above formats selects that format.
$ hledger print $ hledger print
@ -1485,23 +1488,40 @@ COMMANDS
assets:bank:checking $-1 assets:bank:checking $-1
The print command displays full journal entries (transactions) from the The print command displays full journal entries (transactions) from the
journal file, tidily formatted. journal file in date order, tidily formatted. print's output is always
a valid hledger journal. It preserves all transaction information, but
it does not preserve directives or inter-transaction comments
As of hledger 1.2, print's output is always a valid hledger journal. Normally, the journal entry's explicit or implicit amount style is pre-
However it may not preserve all original content, eg it does not print served. Ie when an amount is omitted in the journal, it will be omit-
directives or inter-transaction comments. ted in the output. You can use the -x/--explicit flag to make all
amounts explicit, which can be useful for troubleshooting or for making
Normally, transactions' implicit/explicit amount style is preserved: your journal more readable and robust against data entry errors. Note,
when an amount is omitted in the journal, it will be omitted in the -x will cause postings with a multi-commodity amount (these can arise
output. You can use the -x/--explicit flag to make all amounts when a multi-commodity transaction has an implicit amount) will be
explicit, which can be useful for troubleshooting or for making your split into multiple single-commodity postings, for valid journal out-
journal more readable and robust against data entry errors. Note, in put.
this mode postings with a multi-commodity amount (possible with an
implicit amount in a multi-commodity transaction) will be split into
multiple single-commodity postings, for valid journal output.
With -B/--cost, amounts with transaction prices are converted to cost With -B/--cost, amounts with transaction prices are converted to cost
(using the transaction price). using that price.
With -m/--match and a STR argument, print will show at most one trans-
action: the one one whose description is most similar to STR, and is
most recent. STR should contain at least two characters. If there is
no similar-enough match, no transaction will be shown.
With --new, for each FILE being read, hledger reads (and writes) a spe-
cial .FILE.seen file in the same directory, containing the latest
transaction date(s) that were seen last time FILE was read. When this
file is found, only transactions with newer dates (and new transactions
on the latest date) are printed. This is useful for ignoring
already-seen entries in import data, such as downloaded CSV files. Eg:
$ hledger -f bank1.csv print --new
# shows transactions added since last print --new on this file
It assumes that only same-or-newer-dated transactions are added to
FILE, and that the order of same-date transactions remains stable.
The print command also supports output destination and CSV output. The print command also supports output destination and CSV output.
Here's an example of print's CSV output: Here's an example of print's CSV output: