Crates.io | argser |
lib.rs | argser |
version | 0.2.3 |
source | src |
created_at | 2021-08-04 18:05:09.500015 |
updated_at | 2021-08-25 19:24:44.35396 |
description | Allows you to easily parse and handle CLI-Arguments |
homepage | |
repository | https://github.com/Lol3rrr/argser |
max_upload_size | |
id | 431646 |
size | 25,209 |
A library to handle configuration for Programs
name
: The Nameuse argser::argser;
#[argser]
struct Options {
name: String,
}
fn main() {
let opts: Options = argser::parse_cli().unwrap();
println!("Hello {}", opts.name);
}
name
: The Namecon.domain
: The Domaincon.port
: The Portuse 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);
}