ExLedger.LedgerCLI (ex_ledger v0.6.0)
Wrapper for calling the external ledger CLI binary.
Summary
Functions
Runs the ledger CLI with the given arguments.
Runs the ledger CLI for a specific ledger file and command.
Runs ledger xml for a specific ledger file.
Types
@type cmd_error() :: {non_neg_integer(), String.t()}
Functions
Runs the ledger CLI with the given arguments.
Returns {:ok, output} on success or {:error, {status, output}} on failure.
@spec run_with_file(String.t(), String.t(), [String.t()], keyword()) :: {:ok, String.t()} | {:error, cmd_error()}
Runs the ledger CLI for a specific ledger file and command.
Example:
ExLedger.LedgerCLI.run_with_file("/tmp/ledger.dat", "balance", ["Assets"])
Runs ledger xml for a specific ledger file.
Returns the raw XML output from ledger-cli.
Options
:ledger_bin- Path to ledger binary (default: "ledger"):cmd_opts- Additional options passed toSystem.cmd/3
Example
{:ok, xml} = ExLedger.LedgerCLI.xml("/tmp/ledger.dat")