@@ -655,15 +655,22 @@ def __init__(self):
655
655
self .event_loop = asyncio .new_event_loop ()
656
656
657
657
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
+ )
659
661
660
662
self .app = typer .Typer (
661
663
rich_markup_mode = "rich" ,
662
664
callback = self .main_callback ,
663
665
epilog = _epilog ,
664
666
no_args_is_help = True ,
665
667
)
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
+ )
667
674
self .wallet_app = typer .Typer (epilog = _epilog )
668
675
self .stake_app = typer .Typer (epilog = _epilog )
669
676
self .sudo_app = typer .Typer (epilog = _epilog )
@@ -1497,6 +1504,8 @@ def get_config(self):
1497
1504
Column ("[bold white]Value" , style = "gold1" ),
1498
1505
Column ("" , style = "medium_purple" ),
1499
1506
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 } ]" ,
1500
1509
)
1501
1510
1502
1511
for key , value in self .config .items ():
@@ -2224,14 +2233,15 @@ def wallet_regen_coldkey(
2224
2233
2225
2234
if not wallet_path :
2226
2235
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 ,
2228
2238
)
2229
2239
wallet_path = os .path .expanduser (wallet_path )
2230
2240
2231
2241
if not wallet_name :
2232
2242
wallet_name = Prompt .ask (
2233
2243
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 ,
2235
2245
)
2236
2246
2237
2247
wallet = Wallet (wallet_name , wallet_hotkey , wallet_path )
@@ -2283,7 +2293,8 @@ def wallet_regen_coldkey_pub(
2283
2293
2284
2294
if not wallet_path :
2285
2295
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 ,
2287
2298
)
2288
2299
wallet_path = os .path .expanduser (wallet_path )
2289
2300
@@ -2412,7 +2423,7 @@ def wallet_new_hotkey(
2412
2423
if not wallet_name :
2413
2424
wallet_name = Prompt .ask (
2414
2425
f"Enter the [{ COLORS .G .CK } ]wallet name" ,
2415
- default = defaults .wallet .name ,
2426
+ default = self . config . get ( "wallet_name" ) or defaults .wallet .name ,
2416
2427
)
2417
2428
2418
2429
if not wallet_hotkey :
@@ -2467,11 +2478,11 @@ def wallet_associate_hotkey(
2467
2478
if not wallet_hotkey :
2468
2479
wallet_hotkey = Prompt .ask (
2469
2480
"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 ,
2471
2483
)
2472
2484
2473
- hotkey_display = None
2474
- if is_valid_ss58_address (wallet_hotkey ):
2485
+ if wallet_hotkey and is_valid_ss58_address (wallet_hotkey ):
2475
2486
hotkey_ss58 = wallet_hotkey
2476
2487
wallet = self .wallet_ask (
2477
2488
wallet_name ,
@@ -2492,7 +2503,10 @@ def wallet_associate_hotkey(
2492
2503
validate = WV .WALLET_AND_HOTKEY ,
2493
2504
)
2494
2505
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
+ )
2496
2510
2497
2511
return self ._run_command (
2498
2512
wallets .associate_hotkey (
@@ -2539,13 +2553,14 @@ def wallet_new_coldkey(
2539
2553
2540
2554
if not wallet_path :
2541
2555
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 ,
2543
2558
)
2544
2559
2545
2560
if not wallet_name :
2546
2561
wallet_name = Prompt .ask (
2547
2562
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 ,
2549
2564
)
2550
2565
2551
2566
wallet = self .wallet_ask (
@@ -2618,7 +2633,8 @@ def wallet_check_ck_swap(
2618
2633
2619
2634
if not wallet_ss58_address :
2620
2635
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]"
2622
2638
)
2623
2639
if not wallet_ss58_address :
2624
2640
return self ._run_command (
@@ -2682,18 +2698,18 @@ def wallet_create_wallet(
2682
2698
self .verbosity_handler (quiet , verbose , json_output )
2683
2699
if not wallet_path :
2684
2700
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 ,
2686
2703
)
2687
2704
2688
2705
if not wallet_name :
2689
2706
wallet_name = Prompt .ask (
2690
2707
f"Enter the name of the [{ COLORS .G .CK } ]new wallet (coldkey)" ,
2691
- default = defaults .wallet .name ,
2692
2708
)
2693
2709
if not wallet_hotkey :
2694
2710
wallet_hotkey = Prompt .ask (
2695
2711
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 ,
2697
2713
)
2698
2714
2699
2715
wallet = self .wallet_ask (
@@ -4153,7 +4169,8 @@ def stake_transfer(
4153
4169
interactive_selection = False
4154
4170
if not wallet_hotkey :
4155
4171
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] "
4157
4174
"[dim](or press Enter to select from existing stakes)[/dim]"
4158
4175
)
4159
4176
if origin_hotkey == "" :
0 commit comments