-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from argparse import Action | ||
|
||
FILE = None | ||
DIRECTORY = DIR = None | ||
|
||
|
||
class _PrintCompletionAction(Action): | ||
"""Print completion action.""" | ||
|
||
def __call__(self, parser, namespace, values, option_string): | ||
print("Please install shtab firstly!") | ||
parser.exit(0) | ||
|
||
|
||
def add_argument_to(parser, *args, **kwargs): | ||
"""Add completion argument to parser.""" | ||
Action.complete = None # type: ignore | ||
parser.add_argument( | ||
"--print-completion", | ||
choices=["bash", "zsh", "tcsh"], | ||
action=_PrintCompletionAction, | ||
help="print shell completion script", | ||
) | ||
return parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters