diff --git a/keyring/cli.py b/keyring/cli.py index 748303ed..a9612bab 100755 --- a/keyring/cli.py +++ b/keyring/cli.py @@ -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( @@ -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: diff --git a/newsfragments/636.bugfix.rst b/newsfragments/636.bugfix.rst new file mode 100644 index 00000000..1179f13d --- /dev/null +++ b/newsfragments/636.bugfix.rst @@ -0,0 +1 @@ +Include all operations in the error message if no operation was supplied.