Skip to content

Commit

Permalink
Include all operations in the error message if no operation was suppl…
Browse files Browse the repository at this point in the history
…ied. Fixes #636.
  • Loading branch information
jaraco committed Jun 23, 2023
1 parent c1e291b commit 2a91891
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions keyring/cli.py
Expand Up @@ -37,9 +37,10 @@ def __init__(self):
self.parser.add_argument(
"--disable", action="store_true", help="Disable keyring and exit"
)
self.parser._operations = ["get", "set", "del", "diagnose"]
self.parser.add_argument(
'operation',
choices=["get", "set", "del", "diagnose"],
choices=self.parser._operations,
nargs="?",
)
self.parser.add_argument(
Expand Down Expand Up @@ -103,7 +104,7 @@ def diagnose(self):
print("data root:", platform_.data_root())

def invalid_op(self):
self.parser.error("Specify operation 'get', 'del', or 'set'.")
self.parser.error(f"Specify operation ({', '.join(self.parser._operations)}).")

def _load_spec_backend(self):
if self.keyring_backend is None:
Expand Down
1 change: 1 addition & 0 deletions newsfragments/636.bugfix.rst
@@ -0,0 +1 @@
Include all operations in the error message if no operation was supplied.

0 comments on commit 2a91891

Please sign in to comment.