Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 2fdd291

Browse files
committed
token-cli: don't error when missing default config (#3424)
1 parent 1c9e2a5 commit 2fdd291

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

token/cli/src/main.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,20 +1740,15 @@ fn app<'a, 'b>(
17401740
.about(crate_description!())
17411741
.version(crate_version!())
17421742
.setting(AppSettings::SubcommandRequiredElseHelp)
1743-
.arg({
1744-
let arg = Arg::with_name("config_file")
1743+
.arg(
1744+
Arg::with_name("config_file")
17451745
.short("C")
17461746
.long("config")
17471747
.value_name("PATH")
17481748
.takes_value(true)
17491749
.global(true)
1750-
.help("Configuration file to use");
1751-
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
1752-
arg.default_value(config_file)
1753-
} else {
1754-
arg
1755-
}
1756-
})
1750+
.help("Configuration file to use"),
1751+
)
17571752
.arg(
17581753
Arg::with_name("verbose")
17591754
.short("v")
@@ -2556,6 +2551,8 @@ fn main() -> Result<(), Error> {
25562551
eprintln!("error: Could not find config file `{}`", config_file);
25572552
exit(1);
25582553
})
2554+
} else if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
2555+
solana_cli_config::Config::load(config_file).unwrap_or_default()
25592556
} else {
25602557
solana_cli_config::Config::default()
25612558
};

0 commit comments

Comments
 (0)