5 releases
0.2.3 | Aug 25, 2021 |
---|---|
0.2.2 | Aug 25, 2021 |
0.2.1 | Aug 5, 2021 |
0.2.0 | Aug 4, 2021 |
0.1.0 | Aug 4, 2021 |
#54 in #handle
18KB
416 lines
Argser
A library to handle configuration for Programs
Examples
Simple Use-Case
name
: The Name
Code
use argser::argser;
#[argser]
struct Options {
name: String,
}
fn main() {
let opts: Options = argser::parse_cli().unwrap();
println!("Hello {}", opts.name);
}
Using Subcategories
name
: The Namecon.domain
: The Domaincon.port
: The Port
Code
use argser::argser;
#[argser]
struct Options {
name: String,
#[argser(subcategory)]
con: Connection,
}
#[argser]
struct Connection {
domain: String,
port: u16,
}
fn main() {
let opts: Options = argser::parse_cli().unwrap();
println!("Hello {}", opts.name);
println!("Connecting to {}:{}", opts.con.domain, opts.con.port);
}
Dependencies
~1.5MB
~34K SLoC