cargo-cgp 0.1.0-alpha

A cargo subcommand that runs `cargo check` through the cargo-cgp rustc driver.
//! The `--help` text for the `cargo-cgp` front-end.
//!
//! Shown for `cargo cgp --help` / `-h` and when the tool is run with no subcommand (see
//! [`crate::run::dispatch`]). Kept a pure function that returns the text, so the wording is
//! unit-tested and the actual printing stays at the dispatch edge.

use crate::config::TOOL_VERSION;

/// Whether `arg` is a help flag (`--help` or `-h`).
pub fn is_help_flag(arg: &str) -> bool {
    arg == "--help" || arg == "-h"
}

/// The front-end help text: the tagline, the two invocation forms, the three subcommands,
/// and the top-level options.
pub fn help_text() -> String {
    format!(
        "cargo-cgp {TOOL_VERSION}
Make Context-Generic Programming (CGP) compiler errors readable.

Usage:
    cargo cgp <COMMAND> [ARGS]...
    cargo-cgp <COMMAND> [ARGS]...

Commands:
    check     Check the current package like `cargo check`, presenting CGP errors
              root-cause first. Arguments after `check` are forwarded to `cargo check`.
    setup     Install the pinned nightly toolchain and build the matching driver.
    update    Upgrade cargo-cgp to the latest published version.

Options:
    -h, --help    Print this help.

Run `cargo cgp check --help` to see the underlying `cargo check` options."
    )
}