no-config flag
This commit is contained in:
parent
db59d9a4ae
commit
d046a7d5d4
@ -68,6 +68,7 @@ usage! {
|
|||||||
|
|
||||||
// -- Miscellaneous Options
|
// -- Miscellaneous Options
|
||||||
flag_version: bool,
|
flag_version: bool,
|
||||||
|
flag_no_config: bool,
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// -- Operating Options
|
// -- Operating Options
|
||||||
|
@ -125,6 +125,12 @@ macro_rules! usage {
|
|||||||
|
|
||||||
pub fn parse<S: AsRef<str>>(command: &[S]) -> Result<Self, ArgsError> {
|
pub fn parse<S: AsRef<str>>(command: &[S]) -> Result<Self, ArgsError> {
|
||||||
let raw_args = try!(RawArgs::parse(command));
|
let raw_args = try!(RawArgs::parse(command));
|
||||||
|
|
||||||
|
// Skip loading config file if no_config flag is specified
|
||||||
|
if raw_args.flag_no_config {
|
||||||
|
return Ok(raw_args.into_args(Config::default()));
|
||||||
|
}
|
||||||
|
|
||||||
let config_file = raw_args.flag_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).flag_config);
|
let config_file = raw_args.flag_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).flag_config);
|
||||||
let config_file = replace_home(&config_file);
|
let config_file = replace_home(&config_file);
|
||||||
let config = match (fs::File::open(&config_file), raw_args.flag_config.is_some()) {
|
let config = match (fs::File::open(&config_file), raw_args.flag_config.is_some()) {
|
||||||
|
@ -279,6 +279,7 @@ Miscellaneous Options:
|
|||||||
format as RUST_LOG. (default: {flag_logging:?})
|
format as RUST_LOG. (default: {flag_logging:?})
|
||||||
--log-file FILENAME Specify a filename into which logging should be
|
--log-file FILENAME Specify a filename into which logging should be
|
||||||
directed. (default: {flag_log_file:?})
|
directed. (default: {flag_log_file:?})
|
||||||
|
--no-config Don't load a configuration file.
|
||||||
--no-color Don't use terminal color codes in output. (default: {flag_no_color})
|
--no-color Don't use terminal color codes in output. (default: {flag_no_color})
|
||||||
-v --version Show information about version.
|
-v --version Show information about version.
|
||||||
-h --help Show this screen.
|
-h --help Show this screen.
|
||||||
|
Loading…
Reference in New Issue
Block a user