prikk 0.30.0

A standalone distributed version control system built around block-oriented patch theory.
//! Top-level help output.
//!
//! RFC 118 stage 1: this holds no literal command text of its own. It renders
//! [`crate::commands::COMMANDS`] -- the single declaration of the command surface dispatch also
//! derives from -- plus the fixed header/`Usage:` lines and the `--version` meta line, which is a
//! meta-arm (`main.rs::run`'s own match still handles `--help`/`-h`/`--version`/`-V` directly), not
//! a registry entry.

// RFC 121 §2.1: shadows the prelude's `println!`/`print!` -- see `crate::stdout`'s module doc.
use crate::stdout::println;

/// Print top-level help.
pub(crate) fn print_help(version: &str) {
    println!("prikk {version}");
    println!();
    println!("Usage:");
    for command in crate::commands::COMMANDS {
        for line in command.help_lines {
            println!("{line}");
        }
    }
    println!("  prikk --version                           Print version");
}

/// Print one command's own `--help`/`-h` output (RFC 121 §2.5) -- its `help_lines` verbatim, the
/// same text [`print_help`] already renders inline for every command. `COMMANDS` is a flat table of
/// top-level dispatchable names, not a per-subcommand tree, so `prikk bundle --help` and
/// `prikk bundle export --help` print the same thing: `bundle`'s full `help_lines`, covering
/// export/import/verify together -- there is no finer-grained table to route a subcommand to, and
/// adding one would be the second table RFC 118 forbids.
pub(crate) fn print_command_help(command: &crate::commands::Command) {
    for line in command.help_lines {
        println!("{line}");
    }
}