pactole-cli
Command-line interface of Pactole: the pactole binary.
Role
Built with clap (derive), this crate exposes the features of
pactole-core/pactole-storage-fs through the strict flow (see
../../ARCHITECTURE.md §3.1): all or nothing —
a file is either fully parsed/validated successfully or rejected with
the first error encountered (including in an included file).
Note that the Cargo package is named pactole-cli, but the produced
binary is named pactole (see the [[bin]] of Cargo.toml), so that
cargo install --path crates/pactole-cli directly installs a pactole
command.
Main commands
pactole parse <file>: parses the file and prints (Debug) the resulting journal entries. Mainly useful for debugging the grammar/parser.pactole fmt <file> [--write]: reformats a.pactolefile into its canonical form, printed to stdout by default, or written in place with--write. Accepts-as the file name to read from stdin (always printed to stdout in that case).pactole completions <shell>: generates shell completions to stdout for Bash, Elvish, Fish, PowerShell or Zsh.pactole check <file>: syntax parsing then full business validation (pactole_core::validate_journal) — accounts opened before use/close, commodities declared before use, each transaction's payee declared, each transaction balanced.pactole register <file> [filters]: lists transactions, one line per matching posting, with a running balance per commodity. Without filters, all postings are listed; filters are combined (--accountalso matches sub-accounts,--from/--to,--payee/--narrationare case-insensitive,--tag,--status).
See ../../README.md for complete usage examples and
installation (cargo install --path crates/pactole-cli).
Dependencies / boundaries
pactole-core(validation, register),pactole-storage-fs(PactoleFileStorage,format) — only their historical, strict API.clap(argument parsing),chrono(--from/--tofilter dates).- Never consumes
pactole-syntaxnor the tolerant/positioned flow (analysis.rs/loader.rsofpactole-storage-fs) directly: that flow is reserved forpactole-lsp.
Tests / validation
# End-to-end CLI integration tests
# All tests of the crate
Integration tests live in crates/pactole-cli/tests/cli.rs: add any new
observable CLI behavior (new command, new filter, new exit code) there
rather than in main.rs.
See also
../../ARCHITECTURE.md§3.1 and §6 — strict flow and command details.../../GRAMMAR.md— the.pactolelanguage specification handled by these commands.../../README.md— installation and usage guide for end users.