cliconf
Dead-simple configuration for Rust CLI tools
Example
Create a struct that defines your program's flags:
use Parse;
Initialize the struct, then parse configuration from environment variables and command-line arguments:
let mut conf = Conf ;
conf.parse_env;
conf.parse_args;
let conf = conf;
Use the config throughout your program:
let = if conf.spanish else ;
for _ in 0..conf.repeat
Now, your program will automatically configure itself when given matching environment variables and/or command-line arguments. Here are some examples:
# Hello, world!
# Hello, john!
# Hola, john!
# Hello, john!
# Hello, john!
# Hello, john!
#Hello, john!
#Hello, john!
#Hello, john!
# Hello, john!
# and Hello, aria!
# and Hello, scott!
# and Hello, allie!
NAME=john
# Hello, john!
NAME=john
# Hello, scott!
SPANISH=true NAME=john EXTRA_NAMES=aria,scott,allie
# Hola, john!
# y Hola, aria!
# y Hola, scott!
# y Hola, allie!