docs: update add docs

This commit is contained in:
Simon Michael 2013-04-09 15:54:20 -07:00
parent d5e575c862
commit 6a1460b3b9

View File

@ -539,35 +539,61 @@ Here are some miscellaneous commands you might use to get started:
#### add #### add
The add command prompts interactively for new transactions, and appends The add command prompts interactively for new transactions, and appends
them to the journal file. Each transaction is appended when you complete them to the journal file. Just run `hledger add` and follow the prompts.
it by entering `.` (period) at the account prompt. Enter control-D or You can add as many transactions as you like; when you are finished,
control-C when you are done. press control-d or control-c to exit.
The add command tries to be helpful, providing: Additional convenience features:
- Sensible defaults - Sensible defaults are provided where possible.
You can set the initial defaults by providing them as command line arguments.
If there is a recent transaction with a description similar
to the one you entered, it will be displayed and used for defaults.
- History awareness: if there are existing transactions approximately - Readline-style edit keys may be used during data entry.
matching the description you enter, they will be displayed and the best
match will provide defaults for the other fields. If you specify a
[query](#queries) on the command line, only matching transactions will
be considered as history.
- Readline-style input: during data entry, the usual editing keys should - While entering account names, the tab key will auto-complete or list
work. the available completions, based on the existing transactions.
- Auto-completion for account names: while entering account names, the tab - If the journal defines a [default commodity](#default-commodity),
key will auto-complete as far as possible, or list the available it will be added to any bare numbers entered.
options.
- Default commodity awareness: if the journal has a - A code (in parentheses) may be entered at the Date: prompt, following the date.
[default commodity directive](#default-commodity), that will be applied Comments and/or tags may be entered following a date or amount.
to any bare numbers entered.
Examples: - If you make a mistake, enter `<` at any prompt to restart the transaction.
An example:
$ hledger add $ hledger add
(...)
Starting a new transaction.
date ? [2013/04/09]:
description ? : starbucks
Using this existing transaction for defaults:
2012/04/19 * starbucks
expenses:personal:food:snacks $3.70
assets:cash:wallet $-3.70
account 1 ? [expenses:personal:food:snacks]:
amount 1 ? [$3.7]:
account 2 ? [assets:cash:wallet]:
amount 2 ? [$-3.7]:
account 3 (or . to complete this transaction) ? : .
Transaction entered:
2013/04/09 starbucks
expenses:personal:food:snacks $7.7
assets:cash:wallet $-7.7
Accept this transaction ? [y]:
Added to the journal.
Starting a new transaction.
date ? [2013/04/09]: <CTRL-D>
$
#### test #### test
This command runs hledger's built-in unit tests and displays a quick This command runs hledger's built-in unit tests and displays a quick