Skip to content

Commit 79e4b34

Browse files
committed
Adds snake_case aliases for all commands and options.
1 parent 452ed34 commit 79e4b34

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

bittensor_cli/cli.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import traceback
1212
import warnings
1313
from pathlib import Path
14-
from typing import Coroutine, Optional, Union
14+
from typing import Coroutine, Optional
1515
from dataclasses import fields
1616

1717
import rich
@@ -169,15 +169,29 @@ def edit_help(cls, option_name: str, help_text: str):
169169
help="Path to a JSON file containing the encrypted key backup. For example, a JSON file from PolkadotJS.",
170170
)
171171
json_password = typer.Option(
172-
None, "--json-password", help="Password to decrypt the JSON file."
172+
None,
173+
"--json-password",
174+
"--json_password",
175+
help="Password to decrypt the JSON file.",
173176
)
174177
use_password = typer.Option(
175178
True,
179+
"--use-password",
180+
"--use_password",
176181
help="Set this to `True` to protect the generated Bittensor key with a password.",
177182
)
178-
public_hex_key = typer.Option(None, help="The public key in hex format.")
183+
public_hex_key = typer.Option(
184+
None,
185+
"--public-hex-key",
186+
"--public_hex_key",
187+
help="The public key in hex format.",
188+
)
179189
ss58_address = typer.Option(
180-
None, "--ss58", "--ss58-address", help="The SS58 address of the coldkey."
190+
None,
191+
"--ss58",
192+
"--ss58-address",
193+
"--ss58_address",
194+
help="The SS58 address of the coldkey.",
181195
)
182196
overwrite = typer.Option(
183197
False,
@@ -208,11 +222,14 @@ def edit_help(cls, option_name: str, help_text: str):
208222
)
209223
netuid_not_req = typer.Option(
210224
None,
225+
"--netuid",
211226
help="The netuid of the subnet in the network, (e.g. 1).",
212227
prompt=False,
213228
)
214229
all_netuids = typer.Option(
215230
False,
231+
"--all-netuids/--not-all-netuids",
232+
"--all_netuids/--not_all_netuids",
216233
help="Use all netuids",
217234
prompt=False,
218235
)
@@ -225,6 +242,7 @@ def edit_help(cls, option_name: str, help_text: str):
225242
reuse_last = typer.Option(
226243
False,
227244
"--reuse-last",
245+
"--reuse_last",
228246
help="Reuse the metagraph data you last retrieved."
229247
"Use this option only if you have already retrieved the metagraph."
230248
"data",
@@ -235,10 +253,15 @@ def edit_help(cls, option_name: str, help_text: str):
235253
help="Display the table as HTML in the browser.",
236254
)
237255
wait_for_inclusion = typer.Option(
238-
True, help="If `True`, waits until the transaction is included in a block."
256+
True,
257+
"--wait-for-inclusion",
258+
"--wait_for_inclusion",
259+
help="If `True`, waits until the transaction is included in a block.",
239260
)
240261
wait_for_finalization = typer.Option(
241262
True,
263+
"--wait-for-finalization",
264+
"--wait_for_finalization",
242265
help="If `True`, waits until the transaction is finalized on the blockchain.",
243266
)
244267
prompt = typer.Option(
@@ -276,13 +299,15 @@ def edit_help(cls, option_name: str, help_text: str):
276299
"--slippage-tolerance",
277300
"--tolerance",
278301
"--rate-tolerance",
302+
"--rate_tolerance",
279303
help="Set the rate tolerance percentage for transactions (default: 0.05 for 5%).",
280304
callback=validate_rate_tolerance,
281305
)
282306
safe_staking = typer.Option(
283307
None,
284308
"--safe-staking/--no-safe-staking",
285309
"--safe/--unsafe",
310+
"--safe_staking/--no_safe_staking",
286311
show_default=False,
287312
help="Enable or disable safe staking mode [dim](default: enabled)[/dim].",
288313
)
@@ -292,6 +317,7 @@ def edit_help(cls, option_name: str, help_text: str):
292317
"--partial/--no-partial",
293318
"--allow/--not-allow",
294319
"--allow-partial/--not-partial",
320+
"--allow_partial_stake/--no_allow_partial_stake",
295321
show_default=False,
296322
help="Enable or disable partial stake mode [dim](default: disabled)[/dim].",
297323
)
@@ -308,6 +334,7 @@ def edit_help(cls, option_name: str, help_text: str):
308334
False,
309335
"--json-output",
310336
"--json-out",
337+
"--json_output",
311338
help="Outputs the result of the command as JSON.",
312339
)
313340
period: int = typer.Option(
@@ -929,11 +956,13 @@ def __init__(self):
929956
)(self.view_dashboard)
930957

931958
# Sub command aliases
932-
# Weights
959+
# Wallet
933960
self.wallet_app.command(
934961
"swap_hotkey",
935962
hidden=True,
936963
)(self.wallet_swap_hotkey)
964+
self.wallet_app.command("swap_coldkey", hidden=True)(self.wallet_swap_coldkey)
965+
self.wallet_app.command("swap_check", hidden=True)(self.wallet_check_ck_swap)
937966
self.wallet_app.command(
938967
"regen_coldkey",
939968
hidden=True,
@@ -962,10 +991,14 @@ def __init__(self):
962991
"get_identity",
963992
hidden=True,
964993
)(self.wallet_get_id)
994+
self.wallet_app.command("associate_hotkey")(self.wallet_associate_hotkey)
965995

966996
# Subnets
967997
self.subnets_app.command("burn_cost", hidden=True)(self.subnets_burn_cost)
968998
self.subnets_app.command("pow_register", hidden=True)(self.subnets_pow_register)
999+
self.subnets_app.command("set_identity", hidden=True)(self.subnets_set_identity)
1000+
self.subnets_app.command("get_identity", hidden=True)(self.subnets_get_identity)
1001+
self.subnets_app.command("check_start", hidden=True)(self.subnets_check_start)
9691002

9701003
# Sudo
9711004
self.sudo_app.command("senate_vote", hidden=True)(self.sudo_senate_vote)

0 commit comments

Comments
 (0)