ReverentEngineer / cmdstruct

A lightweight macro for implementing commands with a struct

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmdstruct

A lightweight macro for implementing commands with a struct

Documentation

Usage

use cmdstruct::Command;

#[derive(Command)]
#[command(executable = "echo")]
struct Echo {

    /// Flag to provide
    #[arg(flag = "-n")]
    no_new_line: bool,

    /// String to echo
    #[arg]
    s: String

}

fn main() {
    let echo = Echo {
        no_new_line: true,
        s: "hello world".to_string()
    };

    echo.command().spawn();
}

About

A lightweight macro for implementing commands with a struct

License:Apache License 2.0


Languages

Language:Rust 100.0%