Closed priv-kweihmann closed 7 months ago
I don't think this is possible because -
is recognized as the start of the next option. You may be able to find a solution by adjusting the behaviors in https://github.com/kislyuk/argcomplete/blob/develop/argcomplete/packages/_argparse.py but I'm not aware of a way. You can work around this by using a =
after the option name: --b=...
.
To be clear, this is not accepted by argparse either. In this case, argcomplete is completing your command line exactly how argparse sees it.
$ python example.py --b -filename
usage: ex.py [-h] [--a] [--b B]
ex.py: error: argument --b: expected one argument
$ python example.py --b=-filename
Namespace(a=False, b='-filename')
I have the following example code
--b
could be a file or a filename prefixed with-
or+
.While for no prefix and
+
everything is working like I would expect it, for-
I get instead of a potential list of files just the root level overviewIs there any way to make argcomplete aware that in the context of
--b
to run the custom completer function?