docopt-ng icon indicating copy to clipboard operation
docopt-ng copied to clipboard

ability to declare long parameters using just a single `-`, e.g. `-Ssendwait`

Open FelixSchwarz opened this issue 6 months ago • 0 comments

Some Unix commands have longer parameter names which just start with a single dash, e.g. -Ssendwait. argparse can handle these parameters but I'm unable to do this with docopt-ng:

#!/usr/bin/env python3
"""
Usage:
  foo [options]

Options:
  -Ssendwait     wait until request was sent
  -Snosendwait   return immediately
"""

from docopt import docopt
arguments = docopt(__doc__)
print(arguments)
$ ./parse-docopt.py -Snosendwait
Warning: found unmatched (duplicate?) arguments [Option('-S', None, 0, True), Option('-n', None, 0, True), Option('-o', None, 0, True), Option('-s', None, 0, True), Option('-e', None, 0, True), Option('-n', None, 0, True), Option('-d', None, 0, True), Option('-w', None, 0, True), Option('-a', None, 0, True), Option('-i', None, 0, True), Option('-t', None, 0, True)]
Usage:
  foo [options]

FelixSchwarz avatar Aug 08 '24 12:08 FelixSchwarz