diff options
author | Sam Schott <ss2151@cam.ac.uk> | 2021-05-23 20:55:54 +0100 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-07-04 06:49:49 -0700 |
commit | 91e388027d2270966e5a75e7a55b8cea3becc66b (patch) | |
tree | d22ec904a8a4d268b19f6b1cadb12f6eeea3bd7e /src/click/shell_completion.py | |
parent | 2184ab1fdaf2956457c866dc68f87d09ca9af101 (diff) | |
download | click-91e388027d2270966e5a75e7a55b8cea3becc66b.tar.gz |
completion arguments may start with a "/"
Diffstat (limited to 'src/click/shell_completion.py')
-rw-r--r-- | src/click/shell_completion.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py index b444bae..cad080d 100644 --- a/src/click/shell_completion.py +++ b/src/click/shell_completion.py @@ -450,7 +450,12 @@ def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: def _start_of_option(value: str) -> bool: """Check if the value looks like the start of an option.""" - return not value[0].isalnum() if value else False + if not value: + return False + + c = value[0] + # Allow "/" since that starts a path. + return not c.isalnum() and c != "/" def _is_incomplete_option(args: t.List[str], param: Parameter) -> bool: |