xacli-core 0.2.0

Core library for XaCLI - command parsing, execution engine, and shell completion
Documentation

xacli-core

Core CLI framework for Rust with command parsing, execution engine, and shell completion.

Features

  • Command tree with subcommands
  • Arguments and flags parsing
  • Type-safe value access
  • Execution hooks (pre_run, run, post_run)
  • Shell completion (Bash, Zsh, Fish, PowerShell)
  • Colored terminal output
  • Validators and environment variables

Quick Start

use xacli_core::prelude::*;

fn main() -> Result<()> {
    let cmd = Command::new("myapp")
        .version("1.0.0")
        .short_help("My CLI application")
        .arg(Arg::new("name").required(true).build())
        .run(|ctx| {
            let name = ctx.get_arg_string("name")?;
            println!("Hello, {}!", name);
            Ok(())
        })
        .build();

    Runner::new(cmd).run()
}

Examples

cargo run --example demo -- --help
cargo run --example demo -- greet Alice
cargo run --example completion -- complete bash
cargo run --example validator -- single --age 25 --name John --level info

Documentation

License

Apache-2.0