cli-command 0.1.0

A lightweight and ergonomic command-line argument parser for Rust
Documentation
//! A simple example demonstrating the cli_args! macro.
//!
//! This example shows how the cli_args! macro can dramatically reduce
//! boilerplate code for argument parsing while maintaining type safety.

use cli_command::{cli_args, parse_command_line};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("🔧 Simple CLI Args Macro Demo");
    println!();

    let (name, age, email, port) = cli_args!(
        name: String = "Anonymous".to_string(),
        age: u32 = 25,
        email: String = "user@example.com".to_string(),
        port: u16 = 8080
    );

    let cmd = parse_command_line()?;
    let is_active = cmd.contains_argument("is-active");

    println!("📋 Parsed Arguments:");
    println!("   Name: {}", name);
    println!("   Age: {}", age);
    println!("   Email: {}", email);
    println!("   Active: {}", is_active);
    println!("   Port: {}", port);

    println!();
    println!("✨ Notice how the cli_args! macro eliminated this boilerplate:");
    println!("   let name = cmd.get_argument_or_default(\"name\", \"Anonymous\".to_string())?;");
    println!("   let age = cmd.get_argument_or_default(\"age\", 25)?;");
    println!(
        "   let email = cmd.get_argument_or_default(\"email\", \"user@example.com\".to_string())?;"
    );
    println!("   let is_active = cmd.get_argument_or_default(\"is_active\", true)?;");
    println!("   let port = cmd.get_argument_or_default(\"port\", 8080)?;");

    println!();
    println!("🚀 Try running with different arguments:");
    println!("   cargo run --example simple_macro_test -- --name Alice --age 30 --port 3000");
    println!("   cargo run --example simple_macro_test -- --name Bob --email bob@company.com --is-active false");

    Ok(())
}