Crate workhelix_cli_common

Crate workhelix_cli_common 

Source
Expand description

Common functionality for Workhelix Rust CLI tools.

This library provides shared functionality for CLI tools including:

  • Shell completion generation
  • Health check framework
  • License display
  • Terminal output utilities

§Example Usage

use workhelix_cli_common::{
    RepoInfo, DoctorChecks, DoctorCheck,
    completions, doctor, license,
};
use clap::Parser;

#[derive(Parser)]
struct Cli {
    // your CLI definition
}

struct MyTool;

impl DoctorChecks for MyTool {
    fn repo_info() -> RepoInfo {
        RepoInfo::new("myorg", "mytool")
    }

    fn current_version() -> &'static str {
        env!("CARGO_PKG_VERSION")
    }

    fn tool_checks(&self) -> Vec<DoctorCheck> {
        vec![
            DoctorCheck::file_exists("~/.config/mytool/config.toml"),
        ]
    }
}

// Generate completions
completions::generate_completions::<Cli>(clap_complete::Shell::Bash);

// Run health check
let tool = MyTool;
let exit_code = doctor::run_doctor(&tool);

Re-exports§

pub use doctor::DoctorChecks;
pub use license::LicenseType;
pub use types::DoctorCheck;
pub use types::RepoInfo;
pub use completions::generate_completions;
pub use doctor::run_doctor;
pub use license::display_license;

Modules§

completions
Shell completion generation module.
doctor
Health check and diagnostics module.
license
License display module.
output
Output utilities for consistent terminal formatting.
types
Shared types for Workhelix CLI tools.