Skip to content

Commit 2a91891

Browse files
committed
Include all operations in the error message if no operation was supplied. Fixes #636.
1 parent c1e291b commit 2a91891

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

keyring/cli.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ def __init__(self):
3737
self.parser.add_argument(
3838
"--disable", action="store_true", help="Disable keyring and exit"
3939
)
40+
self.parser._operations = ["get", "set", "del", "diagnose"]
4041
self.parser.add_argument(
4142
'operation',
42-
choices=["get", "set", "del", "diagnose"],
43+
choices=self.parser._operations,
4344
nargs="?",
4445
)
4546
self.parser.add_argument(
@@ -103,7 +104,7 @@ def diagnose(self):
103104
print("data root:", platform_.data_root())
104105

105106
def invalid_op(self):
106-
self.parser.error("Specify operation 'get', 'del', or 'set'.")
107+
self.parser.error(f"Specify operation ({', '.join(self.parser._operations)}).")
107108

108109
def _load_spec_backend(self):
109110
if self.keyring_backend is None:

newsfragments/636.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Include all operations in the error message if no operation was supplied.

0 commit comments

Comments
 (0)