;doc:run, repl: updates
This commit is contained in:
parent
d65cdbef27
commit
a0cf410a80
@ -26,6 +26,7 @@ The command syntax is the same as with `run`:
|
|||||||
- type `exit` or `quit` or control-D to exit the REPL.
|
- type `exit` or `quit` or control-D to exit the REPL.
|
||||||
|
|
||||||
While it is running, the REPL remembers your command history, and you can navigate in the usual ways:
|
While it is running, the REPL remembers your command history, and you can navigate in the usual ways:
|
||||||
|
|
||||||
- Keypad or Emacs navigation keys to edit the current command line
|
- Keypad or Emacs navigation keys to edit the current command line
|
||||||
- UP/DOWN or control-P/control-N to step back/forward through history
|
- UP/DOWN or control-P/control-N to step back/forward through history
|
||||||
- control-R to search for a past command, etc.
|
- control-R to search for a past command, etc.
|
||||||
@ -37,8 +38,6 @@ You can type control-C to cancel a long-running command (but only once; typing i
|
|||||||
|
|
||||||
And in most shells you can type control-Z to exit temporarily to the shell (and `fg` to return to the REPL).
|
And in most shells you can type control-Z to exit temporarily to the shell (and `fg` to return to the REPL).
|
||||||
|
|
||||||
### Caveats
|
|
||||||
|
|
||||||
You may find some differences in behaviour between `run` command lines and normal hledger command lines.
|
You may find some differences in behaviour between `run` command lines and normal hledger command lines.
|
||||||
For example, in the REPL,
|
For example, in the REPL,
|
||||||
|
|
||||||
@ -49,11 +48,29 @@ For example, in the REPL,
|
|||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
Start the REPL:
|
Start the REPL and enter some commands:
|
||||||
```cli
|
```cli
|
||||||
hledger repl
|
$ hledger repl
|
||||||
|
Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.
|
||||||
|
% stats
|
||||||
|
Main file : .../2025.journal
|
||||||
|
...
|
||||||
|
% stats -f 2024/2024.journal
|
||||||
|
Main file : .../2024.journal
|
||||||
|
...
|
||||||
|
% stats
|
||||||
|
Main file : .../2025.journal
|
||||||
|
...
|
||||||
```
|
```
|
||||||
or
|
|
||||||
|
or:
|
||||||
```cli
|
```cli
|
||||||
hledger repl -f some.journal
|
$ hledger repl -f some.journal
|
||||||
|
Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.
|
||||||
|
% bs
|
||||||
|
...
|
||||||
|
% print -b 'last week'
|
||||||
|
...
|
||||||
|
% bs -f other.journal
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|||||||
@ -38,8 +38,6 @@ If that gives an error, use `#!/usr/bin/env -S hledger run`.
|
|||||||
|
|
||||||
It's ok to use the `run` command recursively within a command script.
|
It's ok to use the `run` command recursively within a command script.
|
||||||
|
|
||||||
### Caveats
|
|
||||||
|
|
||||||
You may find some differences in behaviour between `run` command lines and normal hledger command lines.
|
You may find some differences in behaviour between `run` command lines and normal hledger command lines.
|
||||||
For example, with `run`,
|
For example, with `run`,
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ For example, with `run`,
|
|||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
Run commands specified on the command line:
|
Run commands from the command line:
|
||||||
```cli
|
```cli
|
||||||
hledger -f some.journal run -- balance assets --depth 2 -- balance liabilities -f /some/other.journal --depth 3 --transpose -- stats
|
hledger -f some.journal run -- balance assets --depth 2 -- balance liabilities -f /some/other.journal --depth 3 --transpose -- stats
|
||||||
```
|
```
|
||||||
@ -59,8 +57,9 @@ Run commands from standard input:
|
|||||||
(echo "files"; echo "stats") | hledger -f some.journal run
|
(echo "files"; echo "stats") | hledger -f some.journal run
|
||||||
```
|
```
|
||||||
|
|
||||||
Provide commands as a runnable script:
|
Run commands as a script:
|
||||||
```cli
|
```cli
|
||||||
|
$ cat report
|
||||||
#!/usr/bin/env -S hledger run -f some.journal
|
#!/usr/bin/env -S hledger run -f some.journal
|
||||||
|
|
||||||
echo "List of accounts in some.journal"
|
echo "List of accounts in some.journal"
|
||||||
@ -75,3 +74,9 @@ balance liabilities -f /some/other.journal --depth 3 --transpose
|
|||||||
echo "Commands from another.script, applied to another.journal"
|
echo "Commands from another.script, applied to another.journal"
|
||||||
run -f another.journal another.script
|
run -f another.journal another.script
|
||||||
```
|
```
|
||||||
|
```cli
|
||||||
|
$ chmod +x report
|
||||||
|
$ ./report
|
||||||
|
List of accounts in some.journal
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user