Skip to content

Commit 7d3ee18

Browse files
committed
Added examples
1 parent 814e376 commit 7d3ee18

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

bittensor_cli/cli.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
WalletOptions as WO,
2626
WalletValidationTypes as WV,
2727
Constants,
28-
COLOR_PALETTE,
28+
COLORS,
2929
HYPERPARAMS,
3030
)
3131
from bittensor_cli.version import __version__, __version_as_int__
@@ -341,8 +341,8 @@ def get_optional_netuid(netuid: Optional[int], all_netuids: bool) -> Optional[in
341341
return None
342342
elif netuid is None and all_netuids is False:
343343
answer = Prompt.ask(
344-
f"Enter the [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]netuid"
345-
f"[/{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}] to use. Leave blank for all netuids",
344+
f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid"
345+
f"[/{COLORS.G.SUBHEAD_MAIN}] to use. Leave blank for all netuids",
346346
default=None,
347347
show_default=False,
348348
)
@@ -950,7 +950,8 @@ def initialize_chain(
950950
elif self.config["network"]:
951951
self.subtensor = SubtensorInterface(self.config["network"])
952952
console.print(
953-
f"Using the specified network [{COLOR_PALETTE['GENERAL']['LINKS']}]{self.config['network']}[/{COLOR_PALETTE['GENERAL']['LINKS']}] from config"
953+
f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}"
954+
f"[/{COLORS.G.LINKS}] from config"
954955
)
955956
else:
956957
self.subtensor = SubtensorInterface(defaults.subtensor.network)
@@ -1523,7 +1524,7 @@ def wallet_ask(
15231524
else:
15241525
wallet_name = Prompt.ask(
15251526
"Enter the [blue]wallet name[/blue]"
1526-
+ f" [{COLOR_PALETTE['GENERAL']['HINT']} italic](Hint: You can set this with `btcli config set --wallet-name`)",
1527+
+ f" [{COLORS.G.HINT} italic](Hint: You can set this with `btcli config set --wallet-name`)",
15271528
default=defaults.wallet.name,
15281529
)
15291530

@@ -2049,7 +2050,7 @@ def wallet_regen_coldkey(
20492050

20502051
if not wallet_name:
20512052
wallet_name = Prompt.ask(
2052-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2053+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
20532054
default=defaults.wallet.name,
20542055
)
20552056

@@ -2106,7 +2107,7 @@ def wallet_regen_coldkey_pub(
21062107

21072108
if not wallet_name:
21082109
wallet_name = Prompt.ask(
2109-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2110+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
21102111
default=defaults.wallet.name,
21112112
)
21122113
wallet = Wallet(wallet_name, wallet_hotkey, wallet_path)
@@ -2223,13 +2224,13 @@ def wallet_new_hotkey(
22232224

22242225
if not wallet_name:
22252226
wallet_name = Prompt.ask(
2226-
f"Enter the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]wallet name",
2227+
f"Enter the [{COLORS.G.CK}]wallet name",
22272228
default=defaults.wallet.name,
22282229
)
22292230

22302231
if not wallet_hotkey:
22312232
wallet_hotkey = Prompt.ask(
2232-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
2233+
f"Enter the name of the [{COLORS.G.HK}]new hotkey",
22332234
default=defaults.wallet.hotkey,
22342235
)
22352236

@@ -2285,7 +2286,7 @@ def wallet_new_coldkey(
22852286

22862287
if not wallet_name:
22872288
wallet_name = Prompt.ask(
2288-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2289+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
22892290
default=defaults.wallet.name,
22902291
)
22912292

@@ -2359,12 +2360,12 @@ def wallet_create_wallet(
23592360

23602361
if not wallet_name:
23612362
wallet_name = Prompt.ask(
2362-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2363+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
23632364
default=defaults.wallet.name,
23642365
)
23652366
if not wallet_hotkey:
23662367
wallet_hotkey = Prompt.ask(
2367-
f"Enter the the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
2368+
f"Enter the the name of the [{COLORS.G.HK}]new hotkey",
23682369
default=defaults.wallet.hotkey,
23692370
)
23702371

@@ -2742,9 +2743,10 @@ def wallet_sign(
27422743
self.verbosity_handler(quiet, verbose)
27432744
if use_hotkey is None:
27442745
use_hotkey = Confirm.ask(
2745-
f"Would you like to sign the transaction using your [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]?"
2746-
f"\n[Type [{COLOR_PALETTE['GENERAL']['HOTKEY']}]y[/{COLOR_PALETTE['GENERAL']['HOTKEY']}] for [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]"
2747-
f" and [{COLOR_PALETTE['GENERAL']['COLDKEY']}]n[/{COLOR_PALETTE['GENERAL']['COLDKEY']}] for [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]] (default is [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}])",
2746+
f"Would you like to sign the transaction using your [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]?"
2747+
f"\n[Type [{COLORS.G.HK}]y[/{COLORS.G.HK}] for [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]"
2748+
f" and [{COLORS.G.CK}]n[/{COLORS.G.CK}] for [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}]] "
2749+
f"(default is [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}])",
27482750
default=False,
27492751
)
27502752

@@ -3035,11 +3037,11 @@ def stake_add(
30353037
raise typer.Exit()
30363038
if netuid is not None:
30373039
amount = FloatPrompt.ask(
3038-
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake (TAO τ)"
3040+
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake (TAO τ)"
30393041
)
30403042
else:
30413043
amount = FloatPrompt.ask(
3042-
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake to each netuid (TAO τ)"
3044+
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake to each netuid (TAO τ)"
30433045
)
30443046

30453047
if amount <= 0:
@@ -4112,7 +4114,8 @@ def sudo_set(
41124114
if not param_value:
41134115
if HYPERPARAMS.get(param_name):
41144116
param_value = Prompt.ask(
4115-
f"Enter the new value for [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{param_name}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}] in the VALUE column format"
4117+
f"Enter the new value for [{COLORS.G.SUBHEAD}]{param_name}[/{COLORS.G.SUBHEAD}] "
4118+
f"in the VALUE column format"
41164119
)
41174120
else:
41184121
param_value = None

bittensor_cli/src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ class Sudo(Gettable):
825825

826826

827827
COLOR_PALETTE = ColorPalette()
828+
COLORS = COLOR_PALETTE
828829

829830

830831
SUBNETS = {

0 commit comments

Comments
 (0)