ctl-core 0.7.4

A framework for clap programs: typed results, help, and terminal or JSON output
Documentation
//! One import for a program's `main.rs`.
//!
//! The prelude re-exports what a binary needs:
//!
//! - [`App`] with `app`, and the [`Present`] trait with `view`;
//! - the document builders and the shared flags;
//! - the render and view options, and the `indoc` macros;
//! - clap's `Parser`, `Args`, and `Subcommand` traits, and [`ExitCode`].
//!
//! Each group needs the feature that builds it, so a narrow feature set gets a
//! smaller prelude.
//!
//! The prelude does not bring clap's derive macros along. They expand to
//! `clap::` paths, and `#[derive(Serialize)]` to `serde::` paths, so a program
//! depends on `clap` and `serde` itself, each with its `derive` feature, as the
//! [crate quick start](crate#quick-start) shows.
//!
//! ```no_run
//! use ctl_core::prelude::*;
//! use serde::Serialize;
//!
//! #[derive(Parser)]
//! #[command(version, about = "toy")]
//! struct Cli {
//!     #[command(flatten)]
//!     output: OutputArgs,
//! }
//!
//! #[derive(Serialize)]
//! struct Done;
//!
//! impl Present for Done {
//!     fn present(&self) -> Document {
//!         Document::new().paragraph("done")
//!     }
//! }
//!
//! fn main() -> ExitCode {
//!     App::<Cli>::new("toy")
//!         .view(|cli| cli.output.view())
//!         .run(|_| Ok(Done))
//! }
//! ```
#![cfg_attr(not(feature = "app"), doc = "", doc = "[`App`]: crate#cargo-features")]
#![cfg_attr(
    not(feature = "view"),
    doc = "",
    doc = "[`Present`]: crate#cargo-features"
)]

#[doc(no_inline)]
pub use std::process::ExitCode;

#[cfg(feature = "cli")]
#[doc(no_inline)]
pub use clap::{Args, Parser, Subcommand};
#[doc(no_inline)]
pub use indoc::{concatdoc, eprintdoc, formatdoc, indoc, printdoc, writedoc};

#[cfg(feature = "app")]
pub use crate::app::{App, BrokenPipe};
pub use crate::color::ColorMode;
#[cfg(feature = "document")]
pub use crate::document::{
    Document, Fields, Notice, NoticeLevel, Role, Rule, Section, Table, Text,
};
#[cfg(feature = "cli")]
pub use crate::flags::{
    ColorLong, DryRunArgs, EnvPrefix, FormatArgs, FormatLong, OutputArgs, chassis_warnings,
    emit_warnings, warn_opposites,
};
pub use crate::format::OutputFormat;
pub use crate::model::{Envelope, ErrorBody, SCHEMA_VERSION};
#[cfg(feature = "cli")]
pub use crate::parser::verify;
#[cfg(any(feature = "view", feature = "help"))]
pub use crate::render::{
    DEFAULT_COLUMN_BUFFER, DEFAULT_COLUMN_BUFFER_ENV, DEFAULT_COLUMN_BUFFER_ENVS,
    DEFAULT_MINIMUM_AUTOMATIC_WIDTH,
};
#[cfg(feature = "render")]
pub use crate::render::{
    DEFAULT_FALLBACK_WIDTH, DEFAULT_LIST_STYLE_ENV, DEFAULT_LIST_STYLE_ENVS,
    DEFAULT_RECORD_STYLE_ENV, DEFAULT_RECORD_STYLE_ENVS, DEFAULT_ROW_SEPARATION_ENV,
    DEFAULT_ROW_SEPARATION_ENVS, Frame, RecordStyle, RenderOptions, RowSeparation,
};
#[cfg(feature = "surface-model")]
pub use crate::surface::Surface;
#[cfg(feature = "render")]
pub use crate::theme::Theme;
#[cfg(feature = "usage")]
pub use crate::usage::{mount_directives, mount_line, spec, spec_bin, take};
#[cfg(feature = "view")]
pub use crate::view::{
    Captured, DEFAULT_JSON_LAYOUT_ENV, DEFAULT_JSON_LAYOUT_ENVS, Destination, JsonLayout, Outcome,
    Present, View,
};