Crate clap_conf[−][src]
Expand description
Clap Conf
Use this library to unify how you get configuration options from
- The command line arguments
- Config Files
- Environmant Variables
Basic Usage
use clap_conf::prelude::*;
let matches = clap_app!(my_app=>
(@arg filename:-f +takes_value "the input filename")
//...
).get_matches();
let cfg = with_toml_env(&matches,&["toml/config/locations"]);
//the result must be a String as std::env::var has to return a String not a pointer
let filename =
cfg.grab().arg("filename").conf("input.filename").env("MY_APP_INPUT_FILE").def("default.file");
//if the arguments were supplied this would return something else.
assert_eq!(filename,"default.file".to_string());
Modules
Macros
Build App
, Arg
s, SubCommand
s and Group
s with Usage-string like input
but without the associated parsing runtime cost.
Allows you to pull the version from your Cargo.toml at compile time as
MAJOR.MINOR.PATCH_PKGVERSION_PRE
Structs
Used to get information about the arguments that were supplied to the program at runtime by
the user. New instances of this struct are obtained by using the App::get_matches
family of
methods.
An iterator for getting multiple values out of an argument via the ArgMatches::values_of
method.