to check whether all available ledger options documented and are being tested. Signed-off-by: Alexis Hildebrandt <afh@surryhill.net>
1060 lines
31 KiB
Groff
1060 lines
31 KiB
Groff
.Dd March 23, 2012
|
||
.Dt ledger 1
|
||
.Sh NAME
|
||
.Nm ledger
|
||
.Nd Command-line, double-entry account reporting tool
|
||
.Sh SYNOPSIS
|
||
ledger
|
||
.Op Ar command
|
||
.Op Ar options
|
||
.Op Ar arguments
|
||
.Sh DESCRIPTION
|
||
Ledger is a command-line accounting tool based on the power and completeness
|
||
of double-entry accounting. It is only a reporting tool, which means it never
|
||
modifies your data files, but it does offers a large selection of reports, and
|
||
different ways to customize them to your liking.
|
||
.Pp
|
||
.Sh COMMANDS
|
||
Ledger accepts several top-level commands, each of which generates a different
|
||
kind of basic report. Most of them accept a
|
||
.Ar report-query
|
||
argument, in order to determine what should be reported. To understand the
|
||
syntax of a
|
||
.Ar report-query ,
|
||
see the section on
|
||
.Sx QUERIES .
|
||
In its most basic form, simply specifying one or more strings produces a
|
||
report for all accounts containing those strings.
|
||
.Pp
|
||
If no command is given, Ledger enters a
|
||
.Tn REPL ,
|
||
or command loop, allowing several commands to be executed against the same
|
||
dataset without reparsing.
|
||
.Pp
|
||
The following is a complete list of reporting commands accepted by Ledger:
|
||
.Bl -tag -width accounts
|
||
.It Nm accounts Oo Ar report-query Oc
|
||
Lists all accounts for postings matching the
|
||
.Ar report-query .
|
||
.El
|
||
.Pp
|
||
.Bl -tag -width balance
|
||
.It Nm balance Oo Ar report-query Oc
|
||
Produces a balance report showing totals for all matching accounts, and
|
||
aggregate totals for parents of those accounts. Options most commonly used
|
||
with this command are:
|
||
.Pp
|
||
.Bl -tag -compact -width "--collapse (-n)"
|
||
.It Fl \-basis Pq Fl B
|
||
Report in terms of cost basis, not amount or value. This is the only form of
|
||
report which is guaranteed to always balance to zero, when no
|
||
.Ar report-query
|
||
is specified.
|
||
Only show totals for the top-most accounts.
|
||
.It Fl \-empty Pq Fl E
|
||
Also show accounts whose total is zero.
|
||
.It Fl \-flat
|
||
Rather than display a hierarchical tree, flatten the report to show subtotals
|
||
for only accounts matching
|
||
.Ar report-query .
|
||
.It Fl \-no-total
|
||
Suppress the summary total shown at the bottom of the report (when not zero).
|
||
.El
|
||
.Pp
|
||
The synonyms
|
||
.Nm bal
|
||
and
|
||
.Nm b
|
||
are also accepted.
|
||
.It Nm budget Oo Ar report-query Oc
|
||
A special balance report which includes three extra columns: the amount
|
||
budgeted during the reporting period, how spending differed from the budget,
|
||
and the percentage of budget spent (exceeds 100% if you go over budget).
|
||
Note that budgeting requires one or more
|
||
.Do
|
||
periodic transactions
|
||
.Dc
|
||
to be defined in your data file(s). See the manual for more information.
|
||
.It Nm cleared Oo Ar report-query Oc
|
||
A special balance report which adds two extra columns: the cleared balance for
|
||
each account, and the date of the most recent cleared posting in that account.
|
||
For this accounting to be meaningful, the cleared flag must be set on at least
|
||
one posting. See the manual for more information.
|
||
.It Nm commodities Oo Ar report-query Oc
|
||
Lists all commodities for postings matching the
|
||
.Ar report-query .
|
||
.It Nm convert
|
||
Reads data from a CSV (comma-separated values) file and generates Ledger
|
||
transactions.
|
||
.It Nm csv Oo Ar report-query Oc
|
||
Report of postings matching the
|
||
.Ar report-query
|
||
in CSV format (comma-separated values). Useful for exporting data to a
|
||
spreadsheet for further analysis or charting.
|
||
.It Nm entry Oo Ar entry-template Oc
|
||
Generate and display a new, properly formatted Ledger transaction by comparing
|
||
the
|
||
.Ar entry-template
|
||
to the transactions in your data file(s). For more information on draft
|
||
templates and using this command to quickly create new transactions, see the
|
||
section
|
||
.Sx ENTRIES .
|
||
.Pp
|
||
The synonym
|
||
.Nm xact
|
||
is also accepted.
|
||
.It Nm emacs Oo Ar query Oc
|
||
Outputs posting and transaction data in a format readily consumed by the Emacs
|
||
editor, in a series of Lisp forms. This is used by the
|
||
.Li ledger.el
|
||
Emacs mode to process reporting data from Ledger.
|
||
.It Nm equity Oo Ar report-query Oc
|
||
Prints a series of transactions that balance current totals for
|
||
accounts matching the
|
||
.Ar report-query
|
||
in a special account called
|
||
.Li Equity:Opening Balances .
|
||
The purpose of this report is to close the books for a prior year, while using
|
||
these equity transactions to carry forward those balances.
|
||
.It Nm org
|
||
Produces a journal file suitable for use in the Emacs org mode.
|
||
.It Nm payees Oo Ar report-query Oc
|
||
Lists all payees for postings matching the
|
||
.Ar report-query .
|
||
.It Nm pricemap
|
||
Produces a file which can be used to generate a graph with graphviz showing
|
||
the relationship of commodities in the Ledger file.
|
||
.It Nm prices Oo Ar report-query Oc
|
||
Reports prices for all commodities in postings matching the
|
||
.Ar report-query .
|
||
The prices are reported with the granularity of a single day.
|
||
.It Nm pricedb Oo Ar report-query Oc
|
||
Reports prices for all commodities in postings matching the
|
||
.Ar report-query .
|
||
Prices are reported down to the second, using the same format as the
|
||
.Li ~/.pricedb
|
||
file.
|
||
.It Nm print Oo Ar report-query Oc
|
||
Prints out the full transactions of any matching postings using the same
|
||
format as they would appear in a data file. This can be used to extract
|
||
subsets from a Ledger file to transfer to other files.
|
||
.It Nm push Oo Ar options Oc
|
||
In the
|
||
.Tn REPL ,
|
||
this command pushes a set of command-line options, so that they will apply to
|
||
all subsequent reports.
|
||
.It Nm pop
|
||
In the
|
||
.Tn REPL ,
|
||
pops any option settings that have been pushed.
|
||
.It Nm register Oo Ar report-query Oc
|
||
List all postings matching the
|
||
.Ar report-query .
|
||
This is one of the most common commands, and can be used to provide a variety
|
||
of useful reports. Options most commonly used
|
||
with this command are:
|
||
.Pp
|
||
.Bl -tag -compact -width "--collapse (-n)"
|
||
.It Fl \-average Pq Fl A
|
||
Show the running average, rather than a running total.
|
||
.It Fl \-current Pq Fl c
|
||
Don't show postings beyond the present day.
|
||
.It Fl \-exchange Ar commodity Pq Fl X
|
||
Render all values in the given
|
||
.Ar commodity ,
|
||
if a price conversion rate can be determined. Rates are always displayed
|
||
relative to the date of the posting they are calculated for. This means a
|
||
.Nm register
|
||
report is a historical value report. For current values, it may be preferable
|
||
to use the
|
||
.Nm balance
|
||
report.
|
||
.It Fl \-gain Pq Fl G
|
||
Show any gains (or losses) in commodity values over time.
|
||
.It Fl \-head Ar number
|
||
Only show the top
|
||
.Ar number
|
||
postings.
|
||
.It Fl \-historical Pq Fl H
|
||
.It Fl \-invert
|
||
Invert the value of amounts shown.
|
||
.It Fl \-market Pq Fl V
|
||
Show current market values for all amounts. This is determined in a somewhat
|
||
magical fashion. It is probably more straightforward to use
|
||
.Fl \-exchange Ar commodity Pq Fl X .
|
||
.It Fl \-period Ar time-period Pq Fl p
|
||
Show postings only for the given
|
||
.Ar time-period .
|
||
.It Fl \-related Pq Fl r
|
||
Show postings that are related to those that would have been shown. It has
|
||
the effect of displaying the
|
||
.Do
|
||
other side
|
||
.Dc
|
||
of the values.
|
||
.It Fl \-sort Ar value-expression Pq Fl S
|
||
Sort postings by evaluating the given
|
||
.Ar value-expression .
|
||
Note that a comma-separated list of expressions is allowed, in which case each
|
||
sorting term is used in order to determine the final ordering. For example,
|
||
to search by date and then amount, one would use:
|
||
.Li -S 'date, amount' .
|
||
.It Fl \-tail Ar number
|
||
Only show the last
|
||
.Ar number
|
||
postings.
|
||
.It Fl \-uncleared Pq Fl U
|
||
Only show uncleared (i.e., recent) postings.
|
||
.El
|
||
.Pp
|
||
There are also several grouping options that can be useful:
|
||
.Pp
|
||
.Bl -tag -compact -width "--collapse (-n)"
|
||
.It Fl \-by-payee Pq Fl P
|
||
Group postings by common payee names.
|
||
.It Fl \-daily Pq Fl D
|
||
Group postings by day.
|
||
.It Fl \-weekly Pq Fl W
|
||
Group postings by week (starting on Sundays).
|
||
.It Fl \-start-of-week Ar day-name
|
||
Set the start of each grouped way to the given
|
||
.Ar day-name .
|
||
.It Fl \-monthly Pq Fl M
|
||
Group postings by month.
|
||
.It Fl \-quarterly
|
||
Group postings by fiscal quarter.
|
||
.It Fl \-yearly Pq Fl Y
|
||
Group postings by year.
|
||
.It Fl \-dow
|
||
Group postings by the day of the week on which they took place.
|
||
.It Fl \-subtotal Pq Fl s
|
||
Group all postings together. This is very similar to the totals shown by the
|
||
.Nm balance
|
||
report.
|
||
.El
|
||
.Pp
|
||
The synonyms
|
||
.Nm reg
|
||
and
|
||
.Nm r
|
||
are also accepted.
|
||
.It Nm server
|
||
This command requires that Python support be active. If so, it starts up an
|
||
HTTP server listening for requests on port 9000. This provides an alternate
|
||
interface to creating and viewing reports. Note that this is very much a
|
||
work-in-progress, and will not be fully functional until a later version.
|
||
.It Nm select Oo Ar sql-query Oc
|
||
List all postings matching the
|
||
.Ar sql-query .
|
||
This command allows to generate SQL-like queries.
|
||
.It Nm source
|
||
Parses a journal file and checks it for errors. Ledger will return success
|
||
if no errors are found.
|
||
.It Nm stats Oo Ar report-query Oc
|
||
Provides summary information about all the postings matching
|
||
.Ar report-query .
|
||
It provides information such as:
|
||
.Bl -bullet -offset indent -compact
|
||
.It
|
||
Time range of all matching postings
|
||
.It
|
||
Unique payees
|
||
.It
|
||
Unique accounts
|
||
.It
|
||
Postings total
|
||
.It
|
||
Uncleared postings
|
||
.It
|
||
Days since last posting
|
||
.It
|
||
More...
|
||
.El
|
||
.It Nm xml Oo Ar report-query Oc
|
||
Outputs data relating to the current report in XML format. It includes all
|
||
accounts and commodities involved in the report, plus the postings and the
|
||
transactions they are contained in. See the manual for more information.
|
||
.El
|
||
.Pp
|
||
.Sh OPTIONS
|
||
.Pp
|
||
.Bl -tag -width -indent
|
||
.It Fl \-abbrev-len Ar INT
|
||
Set the minimum length an account can be abbreviated to if it doesn't
|
||
fit inside the
|
||
.Nm account-width .
|
||
If
|
||
.Ar INT
|
||
is zero, then the
|
||
account name will be truncated on the right. If
|
||
.Ar INT
|
||
is greater
|
||
than
|
||
.Nm account-width
|
||
then the account will be truncated on the
|
||
left, with no shortening of the account names in order to fit into the
|
||
desired width.
|
||
.It Fl \-account Ar STR
|
||
Prepend
|
||
.Ar STR
|
||
to all accounts reported. That is, the option
|
||
.Nm --account Personal
|
||
would tack
|
||
.Nm Personal:
|
||
to the beginning of every account reported in a balance report or register report.
|
||
.It Fl \-account-width Ar INT
|
||
Set the width of the account column in the
|
||
.Nm register
|
||
report
|
||
to
|
||
.Ar INT
|
||
characters.
|
||
.It Fl \-actual Pq Fl L
|
||
Report only real transactions, with no automated or virtual
|
||
transactions used.
|
||
.It Fl \-add-budget
|
||
Show only un-budgeted postings.
|
||
.It Fl \-amount Ar EXPR Pq Fl t
|
||
Apply the given value expression to the posting amount. Using
|
||
.Nm --amount Ar EXPR
|
||
you can apply an
|
||
arbitrary transformation to the postings.
|
||
.It Fl \-amount-data Pq Fl j
|
||
On a register report print only the dates and amount of postings.
|
||
Useful for graphing and spreadsheet applications.
|
||
.It Fl \-amount-width Ar INT
|
||
Set the width in characters of the amount column in the
|
||
.Nm register
|
||
report.
|
||
.It Fl \-anon
|
||
Anonymize registry output, mostly for sending in bug reports.
|
||
.It Fl \-args-only
|
||
Ignore init files and environment variables for the ledger run.
|
||
.\".It Fl \-auto-match
|
||
.It Fl \-aux-date
|
||
Show auxiliary dates for all calculations.
|
||
Alias for
|
||
.Fl \-effective
|
||
.It Fl \-average Pq Fl A
|
||
Print average values over the number of transactions instead of
|
||
running totals.
|
||
.It Fl \-balance-format Ar FMT
|
||
Specify the format to use for the
|
||
.Nm balance
|
||
report.
|
||
.\".It Fl \-base
|
||
.It Fl \-basis Pq Fl B
|
||
Report the cost basis on all posting.
|
||
Alias for
|
||
.Fl \-cost
|
||
.It Fl \-begin Ar DATE Pq Fl b
|
||
Specify the start
|
||
.Ar DATE
|
||
of all calculations. Transactions before
|
||
that date will be ignored.
|
||
.It Fl \-bold-if Ar EXPR
|
||
Print the entire line in bold if the given value expression is true.
|
||
.It Fl \-budget
|
||
Only display budgeted items. In a register report this
|
||
displays transaction in the budget, in a balance report this displays
|
||
accounts in the budget.
|
||
.It Fl \-budget-format Ar FMT
|
||
Specify the format to use for the
|
||
.Nm budget
|
||
report.
|
||
.It Fl \-by-payee Pq Fl P
|
||
Group postings in the register report by common payee names.
|
||
.\".It Fl \-cache Ar FILE
|
||
.It Fl \-check-payees
|
||
Enable strict and pedantic checking for payees as well as accounts,
|
||
commodities and tags.
|
||
.It Fl \-cleared Pq Fl C
|
||
Display only cleared postings.
|
||
.It Fl \-cleared-format Ar FMT
|
||
Specify the format to use for the
|
||
.Nm cleared
|
||
report
|
||
.It Fl \-collapse Pq Fl n
|
||
By default ledger prints all accounts in an account tree. With
|
||
.Fl \-collapse
|
||
it prints only the top level account specified.
|
||
.It Fl \-collapse-if-zero
|
||
Collapse the account display only if it has a zero balance.
|
||
.It Fl \-color
|
||
Use color if the terminal supports it.
|
||
Alias for
|
||
.Fl \-ansi
|
||
.It Fl \-columns Ar INT
|
||
Specify the width of the
|
||
.Nm register
|
||
report in characters.
|
||
.It Fl \-cost
|
||
Report the cost basis on all posting.
|
||
Alias for
|
||
.Fl \-basis .
|
||
.It Fl \-count
|
||
Direct ledger to report the number of items when appended to the
|
||
.Nm commodities ,
|
||
.Nm accounts
|
||
or
|
||
.Nm payees
|
||
commands.
|
||
.It Fl \-csv-format Ar FMT
|
||
Specify the format to use for the
|
||
.Nm csv
|
||
report
|
||
.It Fl \-current Pq Fl c
|
||
Shorthand for
|
||
.Nm --limit 'date <= today' .
|
||
.It Fl \-daily Pq Fl D
|
||
Shorthand for
|
||
.Nm --period Ar 'daily' .
|
||
.It Fl \-date Ar EXPR
|
||
Transform the date of the transaction using
|
||
.Ar EXPR .
|
||
.It Fl \-date-format Ar DATEFMT Pq Fl y
|
||
Specify the format ledger should use to print dates.
|
||
.It Fl \-datetime-format Ar FMT
|
||
.It Fl \-date-width Ar INT
|
||
Specify the width, in characters, of the date column in the
|
||
.Nm register
|
||
report.
|
||
.\".It Fl \-day-break
|
||
.It Fl \-dc
|
||
Display register or balance in debit/credit format If you use
|
||
.Fl \-dc
|
||
with either the register (reg) or balance (bal) commands,
|
||
you will now get separate columns for debits and credits.
|
||
.It Fl \-debug Ar STR
|
||
If Ledger has been built with debug options this will provide extra
|
||
data during the run.
|
||
.It Fl \-decimal-comma
|
||
Direct Ledger to parse journals using the European standard comma as
|
||
decimal separator, vice a period.
|
||
.It Fl \-depth Ar INT
|
||
Limit the depth of the account tree. In a balance report, for example,
|
||
a
|
||
.Fl \-depth 2
|
||
statement will print balances only for account with
|
||
two levels, i.e.
|
||
.Nm Expenses:Entertainment
|
||
but not
|
||
.Nm Expenses:entertainment:Dining .
|
||
This is a display predicate, which
|
||
means it only affects display, not the total calculations.
|
||
.It Fl \-deviation Pq Fl D
|
||
Report each posting’s deviation from the average. It is only meaningful
|
||
in the register and prices reports.
|
||
.It Fl \-display Ar EXPR Pq Fl d
|
||
Display lines that satisfy the expression
|
||
.Ar EXPR .
|
||
.It Fl \-display-amount Ar EXPR
|
||
Apply a transformation to the
|
||
.Nm displayed
|
||
amount. This occurs after
|
||
calculations occur.
|
||
.It Fl \-display-total Ar EXPR
|
||
Apply a transformation to the
|
||
.Nm displayed
|
||
total. This occurs after
|
||
calculations occur.
|
||
.It Fl \-dow
|
||
Group transactions by the days of the week.
|
||
Alias for
|
||
.Fl \-days-of-week
|
||
.It Fl \-download
|
||
Cause quotes to be automagically downloaded, as needed, by running
|
||
a script named
|
||
.Nm getquote
|
||
and expecting that script to return
|
||
a value understood by ledger. A sample implementation of
|
||
a
|
||
.Nm getquote
|
||
script, implemented in Perl, is provided in the
|
||
distribution. Downloaded quote price are then appended to the price
|
||
database, usually specified using the environment variable
|
||
.Nm LEDGER_PRICE_DB .
|
||
.It Fl \-empty Pq Fl E
|
||
Include empty accounts in report.
|
||
.It Fl \-end Ar DATE Pq Fl e
|
||
Specify the end
|
||
.Ar DATE
|
||
for a transaction to be considered in the
|
||
report.
|
||
.It Fl \-equity
|
||
Related to the
|
||
.Nm equity
|
||
command. Gives current account balances in the form of a register
|
||
report.
|
||
.\".It Fl \-exact
|
||
.It Fl \-exchange Ar COMMODITY Oo , COMM, ... Oc Pq Fl X
|
||
Display values in terms of the given
|
||
.Ar COMMODITY .
|
||
The latest available price is used.
|
||
.\".It Fl \-explicit
|
||
.It Fl \-file Ar FILE
|
||
Read
|
||
.Ar FILE
|
||
as a ledger file.
|
||
.\".It Fl \-full-help
|
||
.It Fl \-first Ar INT
|
||
Print the first
|
||
.Ar INT
|
||
entries. Opposite of
|
||
.Fl \-tail Ar INT .
|
||
Alias for
|
||
.Fl \-head .
|
||
.It Fl \-flat
|
||
Force the full names of accounts to be used in the balance report. The
|
||
balance report will not use an indented tree.
|
||
.It Fl \-force-color
|
||
Output TTY color codes even if the TTY doesn't support them. Useful
|
||
for TTYs that don't advertise their capabilities correctly.
|
||
.It Fl \-force-pager
|
||
Force Ledger to paginate its output.
|
||
.It Fl \-forecast-while Ar EXPR
|
||
Continue forecasting while
|
||
.Ar VEXPR
|
||
is true.
|
||
Alias for
|
||
.Fl \-forecast .
|
||
.It Fl \-forecast-years Ar INT
|
||
Forecast at most
|
||
.Ar INT
|
||
years into the future.
|
||
.It Fl \-format Ar FMT Pq Fl F
|
||
Use the given format string
|
||
.Ar FMT
|
||
to print output.
|
||
.It Fl \-gain Pq Fl G
|
||
Report net gain or loss for commodities that have a price history.
|
||
.It Fl \-generated
|
||
Include auto-generated postings (such as those from automated
|
||
transactions) in the report, in cases where you normally wouldn't want
|
||
them.
|
||
.It Fl \-group-by Ar EXPR
|
||
Group transaction together in the
|
||
.Nm register
|
||
report.
|
||
.Ar EXPR
|
||
can be anything, although most common would be
|
||
.Nm payee
|
||
or
|
||
.Nm commodity .
|
||
The
|
||
.Nm tags()
|
||
function is also useful here.
|
||
.It Fl \-group-title-format Ar FMT
|
||
Set the format for the headers that separate reports section of
|
||
a grouped report. Only has effect with a
|
||
.Fl \-group-by Ar EXPR
|
||
register report.
|
||
.It Fl \-head Ar INT
|
||
Print the first
|
||
.Ar INT
|
||
entries. Opposite of
|
||
.Fl \-tail Ar INT .
|
||
Alias for
|
||
.Fl \-first
|
||
.It Fl \-help
|
||
Print a summary of all the options, and what they are used for. This
|
||
can be a handy way to remember which options do what. This help screen
|
||
is also printed if ledger is run without a command.
|
||
.\".It Fl \-help-calc
|
||
.\".It Fl \-help-comm
|
||
.\".It Fl \-help-disp
|
||
.It Fl \-immediate
|
||
Instruct ledger to evaluate calculations immediately rather than lazily.
|
||
.\".It Fl \-import
|
||
.It Fl \-init-file Ar FILE
|
||
Causes
|
||
.Nm FILE
|
||
to be read by ledger before any other ledger file.
|
||
This file may not contain any postings, but it may contain option
|
||
settings. To specify options in the init file, use the same syntax as
|
||
the command-line, but put each option on its own line.
|
||
.It Fl \-inject Ar STR
|
||
Use
|
||
.Ar STR
|
||
amounts in calculations. In case you know
|
||
what amount a transaction should be, but the actual transaction has the
|
||
wrong value you can use metadata STR to specify the expected amount.
|
||
.It Fl \-input-date-format Ar DATEFMT
|
||
Specify the input date format for journal entries.
|
||
.It Fl \-invert
|
||
Change the sign of all reported values.
|
||
.It Fl \-last Ar INT
|
||
Report only the last
|
||
.Ar INT
|
||
entries. Only useful on a register
|
||
report.
|
||
Alias for
|
||
.Fl \-tail .
|
||
.It Fl \-leeway Ar INT Pq Fl Z
|
||
Alias for
|
||
.Fl \-price-expr .
|
||
.It Fl \-limit Ar EXPR Pq Fl l
|
||
Limit postings in calculations.
|
||
.It Fl \-lot-dates
|
||
Report the date on which each commodity in a balance report was
|
||
purchased.
|
||
.It Fl \-lot-notes
|
||
Report the tag attached to each commodity in a balance report.
|
||
.It Fl \-lot-prices
|
||
Report the price at which each commodity in a balance report was
|
||
purchased.
|
||
.It Fl \-lots
|
||
Report the date and price at which each commodity was purchased in
|
||
a balance report.
|
||
.\".It Fl \-lots-actual
|
||
.It Fl \-market Pq Fl V
|
||
Use the latest market value for all commodities.
|
||
.It Fl \-master-account Ar STR
|
||
Prepend all account names with
|
||
.Ar STR
|
||
.It Fl \-meta Ar EXPR
|
||
In the register report, prepend the transaction with the value of the given
|
||
.Ar TAG .
|
||
.It Fl \-meta-width Ar INT
|
||
Specify the width of the Meta column used for the
|
||
.Fl \-meta Ar TAG
|
||
options.
|
||
.It Fl \-monthly Pq Fl M
|
||
Shorthand for
|
||
.Fl \-period Ar 'monthly' .
|
||
.It Fl \-no-aliases
|
||
Aliases are completely ignored.
|
||
.It Fl \-no-color
|
||
Suppress any color TTY output.
|
||
.\".It Fl \-no-pager
|
||
Suppress any color TTY output.
|
||
.It Fl \-no-rounding
|
||
Don't output
|
||
.Nm <Rounding>
|
||
postings. Note that this will cause the
|
||
running total to often not add up! It's main use is for
|
||
.Fl \-amount-data Pq Fl j
|
||
and
|
||
.Fl \-total-data Pq Fl J
|
||
reports.
|
||
.It Fl \-no-titles
|
||
Suppress the output of group titles.
|
||
.It Fl \-no-total
|
||
Suppress printing the final total line in a balance report.
|
||
.It Fl \-now Ar DATE
|
||
Define the current date in case to you to do calculate in the past or
|
||
future using
|
||
.Fl \-current .
|
||
.It Fl \-only Ar EXPR
|
||
This is a postings predicate that applies after certain transforms have
|
||
been executed, such as periodic gathering.
|
||
.It Fl \-options
|
||
Display the options in effect for this Ledger invocation, along with
|
||
their values and the source of those values.
|
||
.It Fl \-output Ar FILE Pq Fl o
|
||
Redirect the output of ledger to the file defined in
|
||
.Ar FILE .
|
||
.It Fl \-pager Ar STR
|
||
Specify the pager program to use as
|
||
.Ar STR .
|
||
.It Fl \-payee
|
||
Sets a value expression for formatting the payee. In the
|
||
.Nm register
|
||
report this prevents the second entry from having
|
||
a date and payee for each transaction.
|
||
.It Fl \-payee-width Ar INT
|
||
Set the number of columns dedicated to the payee in the register
|
||
report to
|
||
.Ar INT .
|
||
.It Fl \-pedantic
|
||
Accounts, tags or commodities not previously declared will cause errors.
|
||
.It Fl \-pending
|
||
Use only postings that are marked pending.
|
||
.It Fl \-percent Pq Fl \b'%'
|
||
Calculate the percentage value of each account in a balance reports.
|
||
Only works for account that have a single commodity.
|
||
.It Fl \-period Ar PERIOD Pq Fl p
|
||
Define a period expression that sets the time period during which
|
||
transactions are to be accounted. For a
|
||
.Nm register
|
||
report only
|
||
the transactions that satisfy the period expression with be displayed.
|
||
For a balance report only those transactions will be accounted in the
|
||
final balances.
|
||
.It Fl \-period-sort
|
||
Sort the posting within transactions using the given value expression.
|
||
.\".It Fl \-permissive
|
||
.It Fl \-pivot Ar STR
|
||
Produce a balance pivot report
|
||
.Nm around
|
||
the given
|
||
.Ar TAG .
|
||
.It Fl \-plot-amount-format Ar FMT
|
||
Define the output format for an amount data plot.
|
||
.It Fl \-plot-total-format Ar FMT
|
||
Define the output format for a total data plot.
|
||
.It Fl \-prepend-format Ar FMT
|
||
Prepend
|
||
.Ar STR
|
||
to every line of the output.
|
||
.It Fl \-prepend-width Ar INT
|
||
Reserve
|
||
.Ar INT
|
||
spaces at the beginning of each line of the output.
|
||
.It Fl \-price Pq Fl I
|
||
Use the price of the commodity purchase for performing calculations.
|
||
.It Fl \-price-db Ar FILE
|
||
.It Fl \-price-exp Ar STR Pq Fl Z
|
||
Set the expected freshness of price quotes, in
|
||
.Ar INT
|
||
minutes. That
|
||
is, if the last known quote for any commodity is older than this value,
|
||
and if
|
||
.Fl \-download
|
||
is being used, then the Internet will be
|
||
consulted again for a newer price. Otherwise, the old price is still
|
||
considered to be fresh enough.
|
||
Alias for
|
||
.Fl \-leeway Ar INT Pq Fl Z
|
||
.It Fl \-prices-format Ar FMT
|
||
Set the format for the
|
||
.Nm prices
|
||
report.
|
||
.It Fl \-pricedb-format Ar FMT
|
||
Set the format expected for the historical price file.
|
||
.It Fl \-primary-date
|
||
Show primary dates for all calculations. Alias for
|
||
.Fl \-actual-dates
|
||
.It Fl \-quantity Pq Fl O
|
||
Report commodity totals (this is the default).
|
||
.It Fl \-quarterly
|
||
Synonym for
|
||
\Fl \-period Ar 'quarterly' .
|
||
.It Fl \-raw
|
||
In the
|
||
.Nm print
|
||
report, show transactions using the exact same syntax as
|
||
specified by the user in their data file. Don't do any massaging or
|
||
interpreting. Can be useful for minor cleanups, like just aligning
|
||
amounts.
|
||
.It Fl \-real Pq Fl R
|
||
Account using only real transactions ignoring virtual and automatic
|
||
transactions.
|
||
.It Fl \-recursive-aliases
|
||
Causes ledger to try to expand aliases recursively, i.e. try to expand
|
||
the result of an earlier expansion again, until no more expansions apply.
|
||
.It Fl \-register-format Ar FMT
|
||
Define the output format for the
|
||
.Nm register
|
||
report.
|
||
.It Fl \-related Pq Fl r
|
||
In a register report show the related account. This is the other
|
||
.Nm side
|
||
of the transaction.
|
||
.It Fl \-related-all
|
||
Show all postings in a transaction, similar to
|
||
.Fl \-related
|
||
but show
|
||
.Nm both sides
|
||
of each transaction.
|
||
.\".It Fl \-revalued
|
||
.\".It Fl \-revalued-only
|
||
.\".It Fl \-revalued-total Ar EXPR
|
||
.\".It Fl \-rich-data
|
||
.It Fl \-seed Ar INT
|
||
Set the random seed to
|
||
.Ar INT
|
||
for the
|
||
.Nm generate
|
||
command. Used as part of development testing.
|
||
.It Fl \-script Ar FILE
|
||
Execute a ledger script.
|
||
.It Fl \-sort Ar EXPR Pq Fl S
|
||
Sort the register report based on the value expression given to sort.
|
||
.\".It Fl \-sort-all
|
||
.It Fl \-sort-xacts
|
||
Sort the posting within transactions using the given value expression.
|
||
.It Fl \-start-of-week Ar STR
|
||
Tell ledger to use a particular day of the week to start its "weekly"
|
||
summary.
|
||
.Fl \-start-of-week=1
|
||
specifies Monday as the start of the week.
|
||
.It Fl \-strict
|
||
Accounts, tags or commodities not previously declared will cause warnings.
|
||
.It Fl \-subtotal Pq Fl s
|
||
Report register as a single subtotal.
|
||
.It Fl \-tail Ar INT
|
||
Report only the last
|
||
.Ar INT
|
||
entries. Only useful on a register report. Alias for
|
||
.Fl \-last Ar INT
|
||
.It Fl \-time-colon
|
||
Display the value for a seconds based commodity as real hours and minutes,
|
||
thus 8100 seconds will be displayed as 2:15h instead of 2.25h.
|
||
.\".It Fl \-time-report
|
||
.It Fl \-total Ar EXPR Pq Fl T
|
||
Define a value expression used to calculate the total in reports.
|
||
.It Fl \-total-data Pq Fl J
|
||
Show only dates and totals to format the output for plots.
|
||
.It Fl \-total-width Ar INT
|
||
Set the width of the total field in the register report.
|
||
.It Fl \-trace Ar INT
|
||
Enable tracing. The
|
||
.Ar INT
|
||
specifies the level of trace desired.
|
||
.It Fl \-truncate Ar CODE
|
||
Indicates how truncation should happen when the contents of columns
|
||
exceed their width. Valid arguments are
|
||
.Nm leading , Nm middle ,
|
||
and
|
||
.Nm trailing .
|
||
The default is smarter than any of these three,
|
||
as it considers sub-names within the account name (that style is
|
||
called "abbreviate").
|
||
.It Fl \-unbudgeted
|
||
Show only un-budgeted postings.
|
||
.It Fl \-uncleared Pq Fl U
|
||
Use only uncleared transactions in calculations and reports.
|
||
.It Fl \-unrealized
|
||
Show generated unrealized gain and loss accounts in the balance
|
||
report.
|
||
.It Fl \-unrealized-gains
|
||
Allow the user to specify what account name should be used for
|
||
unrealized gains. Defaults to
|
||
.Nm "Equity:Unrealized Gains" .
|
||
Often set in one's
|
||
.Nm ~/.ledgerrc
|
||
file to change the default.
|
||
.It Fl \-unrealized-losses
|
||
Allow the user to specify what account name should be used for
|
||
unrealized gains. Defaults to
|
||
.Nm "Equity:Unrealized Losses" .
|
||
Often set in one's
|
||
.Nm ~/.ledgerrc
|
||
file to change the default.
|
||
.It Fl \-unround
|
||
Perform all calculations without rounding and display results to full
|
||
precision.
|
||
.It Fl \-values
|
||
Shows the values used by each tag when used in combination with the
|
||
.Nm tags
|
||
command.
|
||
.\".It Fl \-value-expr Ar EXPR
|
||
.It Fl \-verbose
|
||
Print detailed information on the execution of Ledger.
|
||
.It Fl \-verify
|
||
Enable additional assertions during run-time. This causes a significant
|
||
slowdown. When combined with
|
||
.Fl \-debug Ar CODE
|
||
ledger will produce memory trace information.
|
||
.\".It Fl \-verify-memory
|
||
.It Fl \-version
|
||
Print version information and exit.
|
||
.It Fl \-weekly Pq Fl W
|
||
Synonym for
|
||
.Fl \-period Ar 'weekly' .
|
||
.It Fl \-wide Pq Fl w
|
||
Assume 132 columns instead of 80.
|
||
.It Fl \-yearly Pq Fl Y
|
||
Synonym for
|
||
.Fl \-period Ar 'yearly' .
|
||
.El
|
||
.Pp
|
||
.Sh PRE-COMMANDS
|
||
Pre-commands are useful when you aren't sure how a command or option
|
||
will work. The difference between a pre-command and a regular command
|
||
is that pre-commands ignore the journal data file completely, nor is
|
||
the user's init file read.
|
||
.Pp
|
||
.Bl -tag -width -indent
|
||
.It Nm args / query
|
||
Evaluate the given arguments and report how Ledger interprets it against
|
||
the following model transaction.
|
||
.It Nm eval
|
||
Evaluate the given value expression against the model transaction.
|
||
.It Nm format
|
||
Print details of how ledger uses the given formatting description and
|
||
apply it against a model transaction.
|
||
.It Nm parse / expr
|
||
Print details of how ledger uses the given value expression description
|
||
and apply it against a model transaction.
|
||
.It Nm generate
|
||
Randomly generates syntactically valid Ledger data from a seed. Used
|
||
by the GenerateTests harness for development testing.
|
||
.It Nm period
|
||
Evaluate the given period and report how Ledger interprets it.
|
||
.It Nm script
|
||
.It Nm template
|
||
Shows the insertion template that the
|
||
.Nm xact
|
||
sub-command generates. This is a debugging command.
|
||
.El
|
||
.Pp
|
||
.Sh QUERIES
|
||
The syntax for reporting queries can get somewhat complex. It is a series of
|
||
query terms with an implicit OR operator between them. The following terms
|
||
are accepted:
|
||
.Bl -tag -width "term and term"
|
||
.It Ar regex
|
||
A bare string is taken as a regular expression matching the full account name.
|
||
Thus, to report the current balance for all assets and liabilities, you would
|
||
use:
|
||
.Pp
|
||
.Dl ledger bal asset liab
|
||
.It Nm payee Ar regex Pq \&@ Ns Ar regex
|
||
Query on the payee, rather than the account.
|
||
.It Nm tag Ar regex Pq \&% Ns Ar regex
|
||
.It Nm note Ar regex Pq \&= Ns Ar regex
|
||
Query on anything found in an item's note.
|
||
.It Nm code Ar regex Pq \&# Ns Ar regex
|
||
Query on the xact's optional code (which can be any string the user wishes).
|
||
.It Ar term Nm and Ar term
|
||
Query terms are joined by an implicit OR operator. You can change this to AND
|
||
by using that keyword. For example, to show food expenditures occurring at
|
||
Shakee's Pizza, you could say:
|
||
.Pp
|
||
.Dl ledger reg food and @Shakee
|
||
.It Ar term Nm or Ar term
|
||
When you wish to be more explicit, use the OR operator.
|
||
.It Nm show
|
||
.It Nm not Ar term
|
||
Reverse the logical meaning of the following term. This can be used with
|
||
parentheses to great effect:
|
||
.Pp
|
||
.Dl ledger reg food and @Shakee and not dining
|
||
.It \&( Ar term No \&)
|
||
If you wish to mix OR and AND operators, it is often helpful to surround
|
||
logical units with parentheses. \fBNOTE\fR: Because of the way some shells
|
||
interpret parentheses, you should always escape them:
|
||
.Pp
|
||
.Dl ledger bal \e\\\&( assets or liab \e\\\&) and not food
|
||
.El
|
||
.Pp
|
||
.Sh EXPRESSIONS
|
||
.Bl -tag -width "partial_account"
|
||
.It Nm account
|
||
.It Nm account_base
|
||
.It Nm account_amount
|
||
.It Nm actual
|
||
.It Nm amount
|
||
.It Nm amount_expr
|
||
.It Fn ansify_if value color bool
|
||
Render the given
|
||
.Ar value
|
||
as a string, applying the proper ANSI escape codes to display it in the given
|
||
.Ar color
|
||
if
|
||
.Ar bool
|
||
is true. It typically checks the value of the option
|
||
.Nm Fl \-color ,
|
||
for example:
|
||
.Dl ansify_if(amount, "blue", options.color)
|
||
.It Nm beg_line
|
||
.It Nm beg_pos
|
||
.It Nm calculated
|
||
.It Nm cleared
|
||
.It Nm code
|
||
.It Nm comment
|
||
.It Nm commodity
|
||
.It Nm cost
|
||
.It Nm count
|
||
.It Nm date
|
||
.It Nm depth
|
||
.It Nm depth_spacer
|
||
.It Nm display_amount
|
||
.It Nm display_total
|
||
.It Nm end_line
|
||
.It Nm end_pos
|
||
.It Nm filename
|
||
.It Nm format_date
|
||
.It Nm get_at
|
||
.It Nm has_meta
|
||
.It Nm has_tag
|
||
.It Nm is_seq
|
||
.It Nm join
|
||
.It Nm market
|
||
.It Nm meta
|
||
.It Nm note
|
||
.It Nm null
|
||
.It Nm options
|
||
.It Nm partial_account
|
||
.It Nm payee
|
||
.It Nm pending
|
||
.It Nm post
|
||
.It Nm print
|
||
.It Nm quantity
|
||
.It Nm quoted
|
||
.It Nm real
|
||
.It Nm rounded
|
||
.It Nm scrub
|
||
.It Nm status
|
||
.It Nm strip
|
||
.It Nm subcount
|
||
.It Nm tag
|
||
.It Nm today
|
||
.It Nm total
|
||
.It Nm total_expr
|
||
.It Nm truncate
|
||
.It Nm uncleared
|
||
.It Nm virtual
|
||
.It Nm xact
|
||
.El
|
||
.Pp
|
||
.Sh ENTRIES
|
||
.Pp
|
||
.Sh FORMATS
|
||
.Pp
|
||
.Sh DEBUG COMMANDS
|
||
In addition to the regular reporting commands, Ledger also accepts several
|
||
debug commands:
|
||
.Bl -tag -width balance
|
||
.It Nm args Oo Ar report-query Oc
|
||
Accepts a
|
||
.Ar report-query
|
||
as its argument and displays it back to the user along with a complete
|
||
analysis of how Ledger interpreted it. Useful if you want to understand how
|
||
report queries are translated into value expressions.
|
||
.It Nm eval Oo Ar value-expression Oc
|
||
Evaluates the given
|
||
.Ar value-expression
|
||
and prints the result. For more on value expressions, see the section
|
||
.Sx EXPRESSIONS .
|
||
.It Nm format Oo Ar format-string Oc
|
||
Accepts a
|
||
.Ar format-string
|
||
and displays an analysis of how it was parsed, and what it would look like
|
||
applied to a sample transaction. For more on format strings, see the section
|
||
.Sx FORMATS .
|
||
.It Nm generate
|
||
Generates 50 randomly composed yet valid Ledger transactions.
|
||
.It Nm parse Oo Ar value-expression Oc
|
||
Parses the given
|
||
.Ar value-expression
|
||
and display an analysis of the expression tree and its evaluated value. For
|
||
more on value expressions, see the section
|
||
.Sx EXPRESSIONS .
|
||
.It Nm python Oo Ar file Oc
|
||
Invokes a Python interpreter to read the given
|
||
.Ar file .
|
||
What is special about this is that the ledger module is builtin, not read from
|
||
disk, so it doesn't require Ledger to be installed anywhere, or the shared
|
||
library variants to be built.
|
||
.It Nm reload
|
||
Used only in the
|
||
.Tn REPL ,
|
||
it causes an immediate reloading of all data files for the current session.
|
||
.It Nm template Oo Ar draft-template Oc
|
||
Accepts a
|
||
.Ar draft-template
|
||
and displays information about how it was parsed. See the section on
|
||
.Sx DRAFTS .
|
||
.El
|
||
.Pp
|
||
.Sh SEE ALSO
|
||
.Xr beancount 1 ,
|
||
.Xr hledger 1
|
||
.Sh AUTHORS
|
||
.An "John Wiegley"
|
||
.Aq johnw@newartisans.com
|
||
.\" .Sh BUGS \" Document known, unremedied bugs
|
||
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
|