Skip to main content

Crate ctl_core

Crate ctl_core 

Source
Expand description

Shared clap chassis and presentation kernel for the *ctl CLIs.

Not a command. Import as ctl_core. Domain handlers return typed data. Document describes the human view, View chooses pretty, colorless, or JSON, and the terminal engine remains private to this crate.

§Cargo features

  • app (enabled by default) — Complete typed CLI lifecycle over the shared help and view layers.
  • cli (enabled by default) — Clap derive helpers (OutputArgs, DryRunArgs) and parser defaults.
  • document (enabled by default) — Semantic presentation documents without a terminal engine.
  • json (enabled by default) — Serde models and the JSON view.
  • render (enabled by default) — Terminal rendering for semantic documents. Engine crates stay private.
  • schema — JSON Schema for the envelope and enums (schemars).
  • help (enabled by default) — Styled -h/--help through the shared document renderer.
  • view (enabled by default) — Pretty / JSON / colorless emitters over serializable models.
  • usage — Mise Usage spec from clap (--usage-spec, served-task mount).

Unused features do not compile clap, comfy-table, or schemars.

Crate docs live here. The GitHub README is not rustdoc.

Re-exports§

pub use app::App;
pub use color::ColorMode;
pub use document::Block;
pub use document::Document;
pub use document::Fields;
pub use document::Notice;
pub use document::NoticeLevel;
pub use document::Role;
pub use document::Rule;
pub use document::Section;
pub use document::Span;
pub use document::Table;
pub use document::Text;
pub use flags::ColorLong;
pub use flags::DryRunArgs;
pub use flags::FlagWarning;
pub use flags::FormatArgs;
pub use flags::FormatLong;
pub use flags::OutputArgs;
pub use flags::WarningKind;
pub use flags::chassis_warnings;
pub use flags::emit_warnings;
pub use flags::resolve_color;
pub use flags::switch;
pub use flags::warn_opposites;
pub use format::OutputFormat;
pub use model::Envelope;
pub use model::ErrorBody;
pub use model::SCHEMA_VERSION;
pub use render::RenderOptions;
pub use render::Renderer;
pub use run::main as run;
pub use table::grid;
pub use table::kv;
pub use usage::mount_line;
pub use usage::spec;
pub use usage::spec_bin;
pub use usage::take;
pub use view::Captured;
pub use view::MessageKind;
pub use view::Present;
pub use view::Stream;
pub use view::View;

Modules§

app
Fluent typed CLI lifecycle. Fluent typed CLI lifecycle.
color
Color policy (auto / always / never).
document
Semantic human presentation independent of a terminal engine. Semantic presentation document shared by every ctl CLI.
flags
Clap flatten structs for shared flags. Shared clap flatten structs.
format
Output representation (pretty / json).
help
Styled -h / --help renderer. Styled help extracted from Clap and rendered as a semantic document.
model
Schema-first wire types. Schema-first wire types. Views render these; they do not own data.
parser
Parser defaults (-h / -V stay on). Parser defaults. -h / --help and -V / --version stay on.
prelude
One-import surface for a *ctl binary (use ctl_core::prelude::*). Import once in a *ctl main.rs.
render
Semantic document renderer. Render semantic documents without exposing the terminal engine.
run
Process ExitCode wrapper. Process exit wrapper.
table
Compact pretty tables for command output. Compatibility helpers over the semantic document renderer.
usage
Mise Usage spec from a clap command. Mise Usage spec from a clap Command.
view
Pretty / JSON / colorless emitters. Pretty, colorless, and JSON emission from one typed model.

Macros§

concatdoc
Unindent and call concat!.
eprintdoc
Unindent and call eprint!.
formatdoc
Unindent and call format!.
indoc
Unindent and produce &'static str or &'static [u8].
printdoc
Unindent and call print!.
writedoc
Unindent and call write!.