xacli-core

Crates.ioxacli-core
lib.rsxacli-core
version0.2.0
created_at2025-11-27 10:44:02.409834+00
updated_at2026-01-15 18:31:00.437846+00
descriptionCore library for XaCLI - command parsing, execution engine, and shell completion
homepage
repositoryhttps://github.com/yufeiminds/xacli
max_upload_size
id1953503
size138,841
Yufei Li (yufeiminds)

documentation

README

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

Commit count: 0

cargo fmt