Repeating positional arguments followed by a single positional argument
See original GitHub issueIt seems that Docopt is currently not able to parse repeated positional arguments (specified by ellipsis) followed by a last single-valued positional argument. I.e. something like this:
#!/usr/bin/env python
__doc__ = """
Usage: mycopy <src>... <dest>
"""
from docopt import docopt
options = docopt(__doc__)
I’m not sure whether it’s possible to do it without making the code too complex, but it would be great if Docopt was able to parse commands like this.
Issue Analytics
- State:
- Created 9 years ago
- Comments:5
Top Results From Across the Web
Positional-Only Arguments - Real Python
In this lesson, you'll learn about how to add positional-only arguments to your functions in Python 3.8. The built-in function float() can be...
Read more >Function Parameters and Arguments in Python
Python prioritises the mapping of positional arguments to their parameter names ... repeated >>> foo(a=1, 2, 3) SyntaxError: positional argument follows ...
Read more >Positional and Keyword Arguments
Python functions can contain two types of arguments: positional arguments and keyword arguments. Positional arguments must be included in the correct order.
Read more >positional argument follows keyword argument - Stack Overflow
The problem lies in that you appear to have copy/pasted the parameter list, and left some of the default values in place, which...
Read more >Understanding *args and *kwargs arguments in Python
Although we have defined only one parameter in the greet() function, the * operator takes the input as a positional argument and is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This also fails:
It might be easier to figure out why if we had #291
Hi! I was wondering if there was some activities related to this issue. I could get it to work with
argparse
, but it would be a shame to move away fromdocopt
.