Difference between revisions of "GnuCash on the Command Line"
From GnuCash
(Add new gnucash-cli quote options.) |
Jim DeLaHunt (talk | contribs) (Change <tt> tags to <pre> or <code> throughout, because <tt> does not give correct formatting, and Help:Formatting does not mention <tt>.) |
||
Line 1: | Line 1: | ||
GnuCash has a command-line interface for use in scripts or for performing quick tasks without launching the graphic interface. Note that | GnuCash has a command-line interface for use in scripts or for performing quick tasks without launching the graphic interface. Note that | ||
− | To see the options for the current version use the command < | + | To see the options for the current version use the command <code>gnucash-cli --help</code>. At version 4.11 this produces the following: |
− | < | + | <pre style="white-space: pre;"> |
bin/gnucash-cli [options] [datafile] - GnuCash, accounting for personal and small business finance: | bin/gnucash-cli [options] [datafile] - GnuCash, accounting for personal and small business finance: | ||
Line 68: | Line 68: | ||
--output-file arg Output file for report | --output-file arg Output file for report | ||
− | </ | + | </pre> |
− | The < | + | The <code>datafile</code> can be either a normal file path or a URI. The URI format is <code>scheme://[[username[:password]@]hostname[:port]]/path</code> where scheme is one of <code>file</code>, <code>mysql</code>, or <code>postgres</code>. <code>mysql</code> and <code>postgres</code> require the hostname including the username and password. The port is needed only if different from the IETF well known ones for the scheme; the path for those two schemes will be the database name supplied when you created the database. |
Latest revision as of 20:21, 6 August 2023
GnuCash has a command-line interface for use in scripts or for performing quick tasks without launching the graphic interface. Note that
To see the options for the current version use the command gnucash-cli --help
. At version 4.11 this produces the following:
bin/gnucash-cli [options] [datafile] - GnuCash, accounting for personal and small business finance: Common Options: -h [ --help ] Show this help message -v [ --version ] Show GnuCash version --debug Enable debugging mode: provide deep detail in the logs. This is equivalent to: --log "=info" --log "qof=info" --log "gnc=info" --extra Enable extra/development/debugging features. --log arg Log level overrides, of the form "modulename={debug,info,warn,crit,error}" Examples: "--log qof=debug" or "--log gnc.backend.file.sx=info" This can be invoked multiple times. --paths Show paths --logto arg File to log into; defaults to "/tmp/gnucash.trace" on most Unix, "%LOCALAPPDATA%\Temp\gnucash.trace.XXXXXX.log", where XXXXXX is replaced with random characters, on Microsoft Windows, and "$TMPDIR/gnucash.trace" on macOS; use "stderr" or "stdout" to write to the terminal or any file path to override the default. Price Quotes Retrieval Options: -Q [ --quotes ] arg Execute price quote related commands. Currently only one command is supported. info: Show Finance::Quote version and exposed quote sources. get: Fetch current quotes for all foreign currencies and stocks in the given GnuCash datafile. dump: Fetch current quotes for specified currencies or stocks from a specified namespace and print the results to the console. This must be followed with a source and one or more symbols, unless the source is "currency" in which case it must be followed with two or more symbols, the first of which is the currency in which exchange rates for the rest will be quoted. --namespace arg Regular expression determining which namespace commodities will be retrieved for -V [ --verbose ] When using the dump command list all of the parameters Finance::Quote returns for the symbol instead of the ones that Gnucash requires. Report Generation Options: -R [ --report ] arg Execute report related commands. The following commands are supported. list: Lists available reports. show: Describe the options modified in the named report. A datafile may be specified to describe some saved options. run: Run the named report in the given GnuCash datafile. --name arg Name of the report to run --export-type arg Specify export type --output-file arg Output file for report
The datafile
can be either a normal file path or a URI. The URI format is scheme://[[username[:password]@]hostname[:port]]/path
where scheme is one of file
, mysql
, or postgres
. mysql
and postgres
require the hostname including the username and password. The port is needed only if different from the IETF well known ones for the scheme; the path for those two schemes will be the database name supplied when you created the database.