Skip to main content

jubarte_cli/
lib.rs

1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! # jubarte-cli
6//!
7//! The jubarte engine's command line: every operation of the library behind
8//! one clap surface - compare, changes, accept, reject, convert, diff, read,
9//! edit, add, comments, append, validate, check, scrub, visual-diff,
10//! capabilities, debug and `self-update` (behind its feature). This crate is
11//! a library with no binary: the `jubarte` executable is built by the
12//! facade crate `jubarte` (`cargo install jubarte`). `build.rs` stamps
13//! `--version` with the source commit when the crate is built from this
14//! repository, and nothing when it is built from an unpacked package inside
15//! another repository.
16//!
17//! # Example
18//!
19//! ```rust
20//! use jubarte_cli::cli::top_level_command;
21//!
22//! fn main() {
23//!     // The full command tree needs more stack than the 1 MiB Windows gives
24//!     // a main thread in a debug build; the `jubarte` binary also parses on
25//!     // an 8 MiB thread.
26//!     let parsed = std::thread::Builder::new()
27//!         .stack_size(8 * 1024 * 1024)
28//!         .spawn(|| {
29//!             top_level_command()
30//!                 .try_get_matches_from([
31//!                     "jubarte", "compare", "old.docx", "new.docx", "-o", "redline.docx",
32//!                 ])
33//!                 .map(|m| m.subcommand_name().map(str::to_owned))
34//!         })
35//!         .expect("spawn the parsing thread")
36//!         .join()
37//!         .expect("the parsing thread does not panic");
38//!     assert_eq!(parsed.expect("the arguments parse").as_deref(), Some("compare"));
39//! }
40//! ```
41
42#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
43#![forbid(unsafe_code)]
44#![warn(missing_docs)]
45
46// A5 shims: every layer below under the names the moved code uses.
47pub use jubarte_doc::comment_settlement;
48#[cfg(feature = "render")]
49pub use jubarte_doc::fields;
50pub use jubarte_doc::{append, audit, changes, comments, debug, inspect, scrub, validate};
51pub use jubarte_dom::{ids, namespaces, perf, unid, util, xmllinq};
52pub use jubarte_edit::{capabilities, edit, markdown, result, text_diff};
53// Host filesystem publication is unavailable to browser/WASM byte APIs
54// (it is cfg'd out of jubarte-edit there).
55#[cfg(not(target_arch = "wasm32"))]
56pub use jubarte_edit::publication;
57pub use jubarte_markdown::legacy_doc;
58pub use jubarte_opc::{admission, opc, settings, strict_translation};
59pub use jubarte_redlines::{document_comparer, revision_processor, wml_document};
60#[cfg(feature = "render")]
61pub use jubarte_render;
62
63/// The `jubarte` command's parser and dispatch.
64pub mod cli;
65/// The typed inline CLI actions, compiled into plan contracts.
66pub mod inline;
67/// `jubarte self-update`: install a GitHub release, only when asked.
68#[cfg(feature = "self-update")]
69pub mod update;