This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -1848,20 +1848,15 @@ fn app<'a, 'b>(
18481848 . about ( crate_description ! ( ) )
18491849 . version ( crate_version ! ( ) )
18501850 . setting ( AppSettings :: SubcommandRequiredElseHelp )
1851- . arg ( {
1852- let arg = Arg :: with_name ( "config_file" )
1851+ . arg (
1852+ Arg :: with_name ( "config_file" )
18531853 . short ( "C" )
18541854 . long ( "config" )
18551855 . value_name ( "PATH" )
18561856 . takes_value ( true )
18571857 . global ( true )
1858- . help ( "Configuration file to use" ) ;
1859- if let Some ( ref config_file) = * solana_cli_config:: CONFIG_FILE {
1860- arg. default_value ( config_file)
1861- } else {
1862- arg
1863- }
1864- } )
1858+ . help ( "Configuration file to use" ) ,
1859+ )
18651860 . arg (
18661861 Arg :: with_name ( "verbose" )
18671862 . short ( "v" )
@@ -2669,6 +2664,8 @@ async fn main() -> Result<(), Error> {
26692664 eprintln ! ( "error: Could not find config file `{}`" , config_file) ;
26702665 exit ( 1 ) ;
26712666 } )
2667+ } else if let Some ( ref config_file) = * solana_cli_config:: CONFIG_FILE {
2668+ solana_cli_config:: Config :: load ( config_file) . unwrap_or_default ( )
26722669 } else {
26732670 solana_cli_config:: Config :: default ( )
26742671 } ;
Original file line number Diff line number Diff line change 11use assert_cmd:: cmd:: Command ;
22
3+ #[ test]
4+ fn no_config_succeeds ( ) {
5+ let mut cmd = Command :: cargo_bin ( "spl-token" ) . unwrap ( ) ;
6+ let args = & [ "address" ] ;
7+ cmd. args ( args) . assert ( ) . code ( 0 ) . success ( ) ;
8+ }
9+
310#[ test]
411fn invalid_config_will_cause_commands_to_fail ( ) {
512 let mut cmd = Command :: cargo_bin ( "spl-token" ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments