Initial commit: clients resource scaffold over invoiceninja-sdk

A command-line client for the Invoice Ninja v5 API, built on the
invoiceninja-sdk crate (consumed from crates.io, 0.2.0). Only the
clients resource is wired up so far, as the template the rest follow
- see CLAUDE.md and GOALS.md for the reasoning behind the shape of
things (the update fetch-merge-write pattern, why there's no Cargo
workspace with the SDK, the local-checkout override for
co-development, and the Nix flake packaging via packages.default and
overlays.default).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 11:47:15 -04:00
co-authored by Claude Sonnet 5
commit dde10e522a
18 changed files with 2308 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
# invoiceninja-cli
A command-line client for the [Invoice Ninja](https://www.invoiceninja.com/)
v5 API, built on [`invoiceninja-sdk`](https://crates.io/crates/invoiceninja-sdk).
> **Early scaffold.** Only the `clients` resource is wired up so far, as the
> template for adding the rest — see `CLAUDE.md` for the pattern.
> [`GOALS.md`](GOALS.md) covers what the crate is for and what it is not.
## Development
Enter the dev shell (Rust toolchain via `rust-overlay`, matching the SDK's):
```sh
nix develop
```
## Usage
Every subcommand needs an API token and, for a self-hosted install, a base
URL. Both can be passed as flags or environment variables (the same names
the SDK's own examples use):
```sh
export IN_API_TOKEN=...
# export IN_BASE_URL=https://your-domain.example/api/v1 # self-hosted only
invoiceninja-cli clients list
invoiceninja-cli clients list --all --status active,archived
invoiceninja-cli clients get <id>
invoiceninja-cli clients create --data '{"name": "Acme Inc"}'
invoiceninja-cli clients update <id> --data '{"city": "Springfield"}'
invoiceninja-cli clients delete <id>
```
`create` and `update` read the record body as JSON, from `--data` inline,
`--file <path>` (`-` for stdin), or stdin if neither flag is given.
`update` fetches the current record first and overlays the given fields on
top of it, so you only need to mention what's changing — see the comment in
`src/body.rs` for why that matters (Invoice Ninja's `PUT` is a full replace,
not a patch).
Add `--output json` to any command for the full record instead of the
table view's few key columns:
```sh
invoiceninja-cli --output json clients get <id>
```