# jubarte-cli
[](https://crates.io/crates/jubarte-cli)
[](https://docs.rs/jubarte-cli)
[](https://github.com/jandira-tech/jubarte/actions/workflows/ci.yml)
[](https://github.com/jandira-tech/jubarte/blob/v0.20.0/crates/jubarte-cli/LICENSE)
[](https://jubarte.readthedocs.io/projects/jubarte-cli/en/latest/)
The command-line layer of the [jubarte](https://github.com/jandira-tech/jubarte) DOCX engine: the
clap declarations of every `jubarte` command (compare, changes, accept,
reject, convert, diff, read, edit, add, comments, append, validate, check,
scrub, visual-diff, capabilities, debug, self-update), their argument
parsing, the typed inline edit actions, and the `self-update` installer.
This crate is a library. It has no binary: the `jubarte` executable is built
by the facade crate. To install the command line, run
`cargo install jubarte`, or see the
[install options](https://github.com/jandira-tech/jubarte/blob/v0.20.0/README.md#cli) for prebuilt binaries.
## Where it sits
`jubarte-dom` → `jubarte-opc` → `jubarte-redlines` / `jubarte-render` →
`jubarte-doc` / `jubarte-markdown` / `jubarte-edit` → `jubarte-cli` → `jubarte`
`jubarte-cli` sits on every other jubarte crate and is the top layer below
the facade `jubarte`, whose binary drives it.
## When to use this crate
Depend on `jubarte-cli` to embed jubarte's command grammar in another tool:
parse the same arguments, render the same help, or build edit plans from the
same flags. To call the engine from Rust, depend on the facade crate [`jubarte`](https://crates.io/crates/jubarte) or a product
crate instead.
## Install
```sh
cargo add jubarte-cli@0.20.0
```
or in `Cargo.toml`:
```toml
[dependencies]
jubarte-cli = "0.20.0"
```
The jubarte crates are released together at one version and pin each other
exactly, so depend on the same version of every jubarte crate you use.
Minimum supported Rust version: 1.94.
## Cargo features
None is on by default (the facade's binary turns on both).
| `render` | The layout-dependent surface through `jubarte-render` (and the `render` features of `jubarte-doc`, `jubarte-markdown` and `jubarte-edit`): the `fields` and `jubarte_render` re-exports and parse-time checking of `--revision-palette` specs. |
| `self-update` | The `update` module behind `jubarte self-update`: finds a GitHub release, checks its SHA-256 and signature, and replaces the binary. Pulls in `self_update` and `ed25519-dalek`. |
## Example
```rust
use jubarte_cli::cli::top_level_command;
fn main() {
// The full command tree needs more stack than the 1 MiB Windows gives
// a main thread in a debug build; the `jubarte` binary also parses on
// an 8 MiB thread.
let parsed = std::thread::Builder::new()
.stack_size(8 * 1024 * 1024)
.spawn(|| {
top_level_command()
.try_get_matches_from([
"jubarte", "compare", "old.docx", "new.docx", "-o", "redline.docx",
])
.map(|m| m.subcommand_name().map(str::to_owned))
})
.expect("spawn the parsing thread")
.join()
.expect("the parsing thread does not panic");
assert_eq!(parsed.expect("the arguments parse").as_deref(), Some("compare"));
}
```
## Modules
- `cli`: the command declarations (`Cli`, `Command`, `top_level_command`) and
their parsing helpers.
- `inline`: compiles one typed inline action (`-p p12 --anchor …`) into an
edit plan.
- `update`: `jubarte self-update` (`self-update` feature).
- Re-exported for the command implementations: `edit`, `markdown`,
`capabilities`, `result`, `text_diff` and `publication` (`jubarte-edit`);
`legacy_doc` (`jubarte-markdown`); `changes`, `comments`,
`comment_settlement`, `validate`, `audit`, `scrub`, `append`, `fields`,
`inspect` and `debug` (`jubarte-doc`); `document_comparer`,
`revision_processor` and `wml_document` (`jubarte-redlines`);
`jubarte_render` (`render` feature); `opc`, `admission`, `settings` and
`strict_translation` (`jubarte-opc`); `xmllinq`, `namespaces`, `ids`,
`unid`, `perf` and `util` (`jubarte-dom`).
## License
[Apache-2.0](https://github.com/jandira-tech/jubarte/blob/v0.20.0/crates/jubarte-cli/LICENSE). [NOTICE](https://github.com/jandira-tech/jubarte/blob/v0.20.0/crates/jubarte-cli/NOTICE) carries the attributions of the
projects this code derives from.
## Links
- API reference: [docs.rs/jubarte-cli](https://docs.rs/jubarte-cli)
- Guide: [jubarte-cli on ReadTheDocs](https://jubarte.readthedocs.io/projects/jubarte-cli/en/latest/), part of the [jubarte documentation](https://jubarte.readthedocs.io/en/latest/)
- Repository: [github.com/jandira-tech/jubarte](https://github.com/jandira-tech/jubarte) ([this crate](https://github.com/jandira-tech/jubarte/tree/v0.20.0/crates/jubarte-cli))
- Command line: the [CLI reference](https://github.com/jandira-tech/jubarte/blob/v0.20.0/README.md#cli-reference) of the root README
- Changes: [CHANGELOG.md](https://github.com/jandira-tech/jubarte/blob/v0.20.0/CHANGELOG.md)