Skip to content

Commit 3921e84

Browse files
committed
Error if using ambiguous args
1 parent a698c01 commit 3921e84

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

bittensor_cli/cli.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,22 +3975,21 @@ def stake_remove(
39753975
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
39763976
validate=WV.WALLET_AND_HOTKEY,
39773977
)
3978-
3979-
if include_hotkeys:
3980-
include_hotkeys = parse_to_list(
3981-
include_hotkeys,
3982-
str,
3983-
"Hotkeys must be a comma-separated list of ss58s or names, e.g., `--include-hotkeys hk1,hk2`.",
3984-
is_ss58=False,
3978+
if not amount and not prompt:
3979+
print_error(
3980+
f"Too ambiguous to use [{COLORS.G.ARG}]--no-prompt[/{COLORS.G.ARG}]. You need to specify an amount,"
3981+
f"or use "
3982+
f"[{COLORS.G.ARG}]--unstake-all[/{COLORS.G.ARG}]/[{COLORS.G.ARG}]--unstake-all-alpha[/{COLORS.G.ARG}]."
39853983
)
39863984
return False
39873985

3988-
if exclude_hotkeys:
3989-
exclude_hotkeys = parse_to_list(
3990-
exclude_hotkeys,
3991-
str,
3992-
"Hotkeys must be a comma-separated list of ss58s or names, e.g., `--exclude-hotkeys hk3,hk4`.",
3993-
is_ss58=False,
3986+
if not amount and json_output:
3987+
json_console.print_json(
3988+
data={
3989+
"success": False,
3990+
"err_msg": "Too amibuous to use '--no-prompt' without specifying and amount or "
3991+
"'--unstake-all'/'--unstake-all-alpha'",
3992+
}
39943993
)
39953994
return False
39963995

0 commit comments

Comments
 (0)