@@ -655,15 +655,22 @@ def __init__(self):
655655 self .event_loop = asyncio .new_event_loop ()
656656
657657 self .config_base_path = os .path .expanduser (defaults .config .base_path )
658- self .config_path = os .path .expanduser (defaults .config .path )
658+ self .config_path = os .getenv ("BTCLI_CONFIG_PATH" ) or os .path .expanduser (
659+ defaults .config .path
660+ )
659661
660662 self .app = typer .Typer (
661663 rich_markup_mode = "rich" ,
662664 callback = self .main_callback ,
663665 epilog = _epilog ,
664666 no_args_is_help = True ,
665667 )
666- self .config_app = typer .Typer (epilog = _epilog )
668+ self .config_app = typer .Typer (
669+ epilog = _epilog ,
670+ help = f"Allows for getting/setting the config. "
671+ f"Default path for the config file is [{ COLORS .G .ARG } ]{ defaults .config .path } [/{ COLORS .G .ARG } ]. "
672+ f"You can set your own with the env var [{ COLORS .G .ARG } ]BTCLI_CONFIG_PATH[/{ COLORS .G .ARG } ]" ,
673+ )
667674 self .wallet_app = typer .Typer (epilog = _epilog )
668675 self .stake_app = typer .Typer (epilog = _epilog )
669676 self .sudo_app = typer .Typer (epilog = _epilog )
@@ -1497,6 +1504,8 @@ def get_config(self):
14971504 Column ("[bold white]Value" , style = "gold1" ),
14981505 Column ("" , style = "medium_purple" ),
14991506 box = box .SIMPLE_HEAD ,
1507+ title = f"[{ COLORS .G .HEADER } ]BTCLI Config[/{ COLORS .G .HEADER } ]: "
1508+ f"[{ COLORS .G .ARG } ]{ self .config_path } [/{ COLORS .G .ARG } ]" ,
15001509 )
15011510
15021511 for key , value in self .config .items ():
@@ -2224,14 +2233,15 @@ def wallet_regen_coldkey(
22242233
22252234 if not wallet_path :
22262235 wallet_path = Prompt .ask (
2227- "Enter the path for the wallets directory" , default = defaults .wallet .path
2236+ "Enter the path for the wallets directory" ,
2237+ default = self .config .get ("wallet_path" ) or defaults .wallet .path ,
22282238 )
22292239 wallet_path = os .path .expanduser (wallet_path )
22302240
22312241 if not wallet_name :
22322242 wallet_name = Prompt .ask (
22332243 f"Enter the name of the [{ COLORS .G .CK } ]new wallet (coldkey)" ,
2234- default = defaults .wallet .name ,
2244+ default = self . config . get ( "wallet_name" ) or defaults .wallet .name ,
22352245 )
22362246
22372247 wallet = Wallet (wallet_name , wallet_hotkey , wallet_path )
@@ -2283,7 +2293,8 @@ def wallet_regen_coldkey_pub(
22832293
22842294 if not wallet_path :
22852295 wallet_path = Prompt .ask (
2286- "Enter the path to the wallets directory" , default = defaults .wallet .path
2296+ "Enter the path to the wallets directory" ,
2297+ default = self .config .get ("wallet_path" ) or defaults .wallet .path ,
22872298 )
22882299 wallet_path = os .path .expanduser (wallet_path )
22892300
@@ -2412,7 +2423,7 @@ def wallet_new_hotkey(
24122423 if not wallet_name :
24132424 wallet_name = Prompt .ask (
24142425 f"Enter the [{ COLORS .G .CK } ]wallet name" ,
2415- default = defaults .wallet .name ,
2426+ default = self . config . get ( "wallet_name" ) or defaults .wallet .name ,
24162427 )
24172428
24182429 if not wallet_hotkey :
@@ -2467,11 +2478,11 @@ def wallet_associate_hotkey(
24672478 if not wallet_hotkey :
24682479 wallet_hotkey = Prompt .ask (
24692480 "Enter the [blue]hotkey[/blue] name or "
2470- "[blue]hotkey ss58 address[/blue] [dim](to associate with your coldkey)[/dim]"
2481+ "[blue]hotkey ss58 address[/blue] [dim](to associate with your coldkey)[/dim]" ,
2482+ default = self .config .get ("wallet_hotkey" ) or defaults .wallet .hotkey ,
24712483 )
24722484
2473- hotkey_display = None
2474- if is_valid_ss58_address (wallet_hotkey ):
2485+ if wallet_hotkey and is_valid_ss58_address (wallet_hotkey ):
24752486 hotkey_ss58 = wallet_hotkey
24762487 wallet = self .wallet_ask (
24772488 wallet_name ,
@@ -2492,7 +2503,10 @@ def wallet_associate_hotkey(
24922503 validate = WV .WALLET_AND_HOTKEY ,
24932504 )
24942505 hotkey_ss58 = wallet .hotkey .ss58_address
2495- hotkey_display = f"hotkey [blue]{ wallet_hotkey } [/blue] [{ COLORS .GENERAL .HK } ]({ hotkey_ss58 } )[/{ COLORS .GENERAL .HK } ]"
2506+ hotkey_display = (
2507+ f"hotkey [blue]{ wallet_hotkey } [/blue] "
2508+ f"[{ COLORS .GENERAL .HK } ]({ hotkey_ss58 } )[/{ COLORS .GENERAL .HK } ]"
2509+ )
24962510
24972511 return self ._run_command (
24982512 wallets .associate_hotkey (
@@ -2539,13 +2553,14 @@ def wallet_new_coldkey(
25392553
25402554 if not wallet_path :
25412555 wallet_path = Prompt .ask (
2542- "Enter the path to the wallets directory" , default = defaults .wallet .path
2556+ "Enter the path to the wallets directory" ,
2557+ default = self .config .get ("wallet_path" ) or defaults .wallet .path ,
25432558 )
25442559
25452560 if not wallet_name :
25462561 wallet_name = Prompt .ask (
25472562 f"Enter the name of the [{ COLORS .G .CK } ]new wallet (coldkey)" ,
2548- default = defaults .wallet .name ,
2563+ default = self . config . get ( "wallet_name" ) or defaults .wallet .name ,
25492564 )
25502565
25512566 wallet = self .wallet_ask (
@@ -2618,7 +2633,8 @@ def wallet_check_ck_swap(
26182633
26192634 if not wallet_ss58_address :
26202635 wallet_ss58_address = Prompt .ask (
2621- "Enter [blue]wallet name[/blue] or [blue]SS58 address[/blue] [dim](leave blank to show all pending swaps)[/dim]"
2636+ "Enter [blue]wallet name[/blue] or [blue]SS58 address[/blue] [dim]"
2637+ "(leave blank to show all pending swaps)[/dim]"
26222638 )
26232639 if not wallet_ss58_address :
26242640 return self ._run_command (
@@ -2682,18 +2698,18 @@ def wallet_create_wallet(
26822698 self .verbosity_handler (quiet , verbose , json_output )
26832699 if not wallet_path :
26842700 wallet_path = Prompt .ask (
2685- "Enter the path of wallets directory" , default = defaults .wallet .path
2701+ "Enter the path of wallets directory" ,
2702+ default = self .config .get ("wallet_path" ) or defaults .wallet .path ,
26862703 )
26872704
26882705 if not wallet_name :
26892706 wallet_name = Prompt .ask (
26902707 f"Enter the name of the [{ COLORS .G .CK } ]new wallet (coldkey)" ,
2691- default = defaults .wallet .name ,
26922708 )
26932709 if not wallet_hotkey :
26942710 wallet_hotkey = Prompt .ask (
26952711 f"Enter the the name of the [{ COLORS .G .HK } ]new hotkey" ,
2696- default = defaults .wallet .hotkey ,
2712+ default = self . config . get ( "wallet_hotkey" ) or defaults .wallet .hotkey ,
26972713 )
26982714
26992715 wallet = self .wallet_ask (
@@ -4153,7 +4169,8 @@ def stake_transfer(
41534169 interactive_selection = False
41544170 if not wallet_hotkey :
41554171 origin_hotkey = Prompt .ask (
4156- "Enter the [blue]origin hotkey[/blue] name or ss58 address [bold](stake will be transferred FROM here)[/bold] "
4172+ "Enter the [blue]origin hotkey[/blue] name or ss58 address [bold]"
4173+ "(stake will be transferred FROM here)[/bold] "
41574174 "[dim](or press Enter to select from existing stakes)[/dim]"
41584175 )
41594176 if origin_hotkey == "" :
0 commit comments