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")
"show all amounts explicitly"
,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
,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
` --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`
: show all amounts explicitly

View File

@ -2058,17 +2058,22 @@ Print all market prices from the journal.
Show transactions from the journal.
Aliases: p, txns.
.TP
.B \f[C]\-x\ \ \ \ \ \-\-explicit\f[]
show all amounts explicitly
.RS
.RE
.TP
.B \f[C]\-m\ STR\ \-\-match=STR\f[]
show the transaction whose description is most similar to STR, and is
most recent
.RS
.RE
.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[]
select the output format.
Supported formats: txt, csv.
@ -2108,24 +2113,50 @@ $\ hledger\ print
.fi
.PP
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
As of hledger 1.2, print\[aq]s output is always a valid hledger journal.
However it may not preserve all original content, eg it does not print
directives or inter\-transaction comments.
.PP
Normally, transactions\[aq] implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be omitted in the
Normally, the journal entry\[aq]s explicit or implicit amount style is
preserved.
Ie when an amount is omitted in the journal, it will be omitted in the
output.
You can use the \f[C]\-x/\-\-explicit\f[] 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.
You can use the \f[C]\-x\f[]/\f[C]\-\-explicit\f[] 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, \f[C]\-x\f[] 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.
.PP
With \-B/\-\-cost, amounts with transaction prices are converted to cost
(using the transaction price).
With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are
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
The print command also supports output destination and 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.
'-x --explicit'
show all amounts explicitly
'-m STR --match=STR'
show the transaction whose description is most similar to STR, 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'
select the output format. Supported formats: txt, csv.
@ -1686,23 +1690,40 @@ $ hledger print
assets:bank:checking $-1
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.
However it may not preserve all original content, eg it does not print
directives or inter-transaction comments.
Normally, the journal entry's explicit or implicit amount style is
preserved. Ie when an amount is omitted in the journal, it will be
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:
when an amount is omitted in the journal, it will be 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, 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 using that price.
With -B/-cost, amounts with transaction prices are converted to cost
(using the transaction price).
With '-m'/'--match' 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.
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.
Here's an example of print's CSV output:
@ -2212,51 +2233,51 @@ Node: prices52658
Ref: #prices52775
Node: print52818
Ref: #print52930
Node: print-unique56705
Ref: #print-unique56833
Node: register56901
Ref: #register57030
Node: Custom register output61531
Ref: #custom-register-output61662
Node: register-match62959
Ref: #register-match63095
Node: rewrite63278
Ref: #rewrite63397
Node: stats63466
Ref: #stats63571
Node: tags64452
Ref: #tags64552
Node: test64584
Ref: #test64670
Node: ADD-ON COMMANDS65038
Ref: #add-on-commands65150
Node: Official add-ons66437
Ref: #official-add-ons66579
Node: api66666
Ref: #api66757
Node: ui66809
Ref: #ui66910
Node: web66968
Ref: #web67059
Node: Third party add-ons67105
Ref: #third-party-add-ons67282
Node: diff67417
Ref: #diff67516
Node: iadd67615
Ref: #iadd67731
Node: interest67814
Ref: #interest67937
Node: irr68032
Ref: #irr68132
Node: Experimental add-ons68210
Ref: #experimental-add-ons68364
Node: autosync68655
Ref: #autosync68769
Node: budget69008
Ref: #budget69132
Node: chart69198
Ref: #chart69317
Node: check69388
Ref: #check69492
Node: print-unique57726
Ref: #print-unique57854
Node: register57922
Ref: #register58051
Node: Custom register output62552
Ref: #custom-register-output62683
Node: register-match63980
Ref: #register-match64116
Node: rewrite64299
Ref: #rewrite64418
Node: stats64487
Ref: #stats64592
Node: tags65473
Ref: #tags65573
Node: test65605
Ref: #test65691
Node: ADD-ON COMMANDS66059
Ref: #add-on-commands66171
Node: Official add-ons67458
Ref: #official-add-ons67600
Node: api67687
Ref: #api67778
Node: ui67830
Ref: #ui67931
Node: web67989
Ref: #web68080
Node: Third party add-ons68126
Ref: #third-party-add-ons68303
Node: diff68438
Ref: #diff68537
Node: iadd68636
Ref: #iadd68752
Node: interest68835
Ref: #interest68958
Node: irr69053
Ref: #irr69153
Node: Experimental add-ons69231
Ref: #experimental-add-ons69385
Node: autosync69676
Ref: #autosync69790
Node: budget70029
Ref: #budget70153
Node: chart70219
Ref: #chart70338
Node: check70409
Ref: #check70513

End Tag Table

View File

@ -1448,13 +1448,16 @@ COMMANDS
print
Show transactions from the journal. Aliases: p, txns.
-x --explicit
show all amounts explicitly
-m STR --match=STR
show the transaction whose description is most similar to STR,
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
select the output format. Supported formats: txt, csv.
@ -1485,23 +1488,40 @@ COMMANDS
assets:bank:checking $-1
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.
However it may not preserve all original content, eg it does not print
directives or inter-transaction comments.
Normally, transactions' implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be 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, 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.
Normally, the journal entry's explicit or implicit amount style is pre-
served. Ie when an amount is omitted in the journal, it will be omit-
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
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 out-
put.
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.
Here's an example of print's CSV output: