Skip to main content

Crate ctl_core

Crate ctl_core 

Source
Expand description

Shared clap chassis for the *ctl CLIs.

Not a command. Import as ctl_core. Models (Envelope, ColorMode, OutputFormat) come first. View picks pretty, JSON, or colorless. JSON never contains ANSI.

§Cargo features

  • cli (enabled by default) — Clap derive helpers (OutputArgs, DryRunArgs) and parser defaults.
  • color (enabled by default) — ANSI streams (anstream / anstyle).
  • json (enabled by default) — Serde models and the JSON view.
  • schema — JSON Schema for the envelope and enums (schemars).
  • help (enabled by default) — Styled -h/--help tables (forkctl / state-sync).
  • 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 color::ColorMode;
pub use flags::ColorLong;
pub use flags::DryRunArgs;
pub use flags::FlagWarning;
pub use flags::FormatArgs;
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 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::Pretty;
pub use view::Render;
pub use view::View;
pub use view::render_template;

Modules§

color
Color policy (auto / always / never).
flags
Clap flatten structs for shared flags. Shared clap flatten structs.
format
Output representation (pretty / json).
help
Styled -h / --help renderer.
layout
Terminal width helpers for help tables. Terminal width helpers for help tables.
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.
run
Process ExitCode wrapper. Process exit wrapper.
style
ANSI styles for pretty views. ANSI styles for pretty views.
table
Compact pretty tables for command output. Compact pretty tables for command output.
usage
Mise Usage spec from a clap command. Mise Usage spec from a clap Command.
view
Pretty / JSON / colorless emitters. Multi-view emit: one serializable model, pretty or JSON, color or not.

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!.