Skip to content

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

Description

@FelixSchwarz

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions