token-cli: don't error when missing default config (#3424)

This commit is contained in:
hana 2022-08-03 14:58:24 -07:00 committed by GitHub
parent 4fadd553e1
commit abc63ad946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -1848,20 +1848,15 @@ fn app<'a, 'b>(
.about(crate_description!())
.version(crate_version!())
.setting(AppSettings::SubcommandRequiredElseHelp)
.arg({
let arg = Arg::with_name("config_file")
.arg(
Arg::with_name("config_file")
.short("C")
.long("config")
.value_name("PATH")
.takes_value(true)
.global(true)
.help("Configuration file to use");
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
arg.default_value(config_file)
} else {
arg
}
})
.help("Configuration file to use"),
)
.arg(
Arg::with_name("verbose")
.short("v")
@ -2669,6 +2664,8 @@ async fn main() -> Result<(), Error> {
eprintln!("error: Could not find config file `{}`", config_file);
exit(1);
})
} else if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
solana_cli_config::Config::load(config_file).unwrap_or_default()
} else {
solana_cli_config::Config::default()
};