Skip to content

Commit

Permalink
When completion is unavailable, exit with non-zero status and emit me…
Browse files Browse the repository at this point in the history
…ssage to stderr.

Closes #671
  • Loading branch information
jaraco committed Apr 2, 2024
1 parent 04bdbd3 commit a2aa173
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions keyring/completion.py
@@ -1,4 +1,5 @@
import argparse
import sys

try:
import shtab
Expand All @@ -10,8 +11,8 @@

class _MissingCompletionAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string):
print("Install keyring[completion] for completion support.")
parser.exit(0)
print("Install keyring[completion] for completion support.", file=sys.stderr)
parser.exit(1)


def add_completion_notice(parser):
Expand Down
1 change: 1 addition & 0 deletions newsfragments/671.bugfix.rst
@@ -0,0 +1 @@
When completion is unavailable, exit with non-zero status and emit message to stderr.

0 comments on commit a2aa173

Please sign in to comment.