2 releases

0.1.1 Dec 2, 2023
0.1.0 Dec 2, 2023

#118 in #argument


Used in argster

MIT license

15KB
314 lines

Argster

A simple command line parser


Argster example

Example

use argster::command;

struct App;

#[command]
impl App {
    /// A hello command
    /// # Args
    /// input The name to greet
    /// --number -n The number of times to greet them
    fn hello(input: String, times: Option<u32>) {
        for _ in 0..times.unwrap_or(1) {
            println!("Hello {input}");
        }
    }
}

fn main() {
    App::main();
}

Command syntax

    -<c>
    -<c><value>
    -<c> <value>
    --<name>
    --<name> <value>

Dependencies

~215–650KB
~16K SLoC