Skip to content

add support for docopt style help #56

@zeteref

Description

@zeteref

It would be nice if cod could learn help in the format proposed by docopt http://docopt.org/

for example if i try to make cod learn their default example:

$ ./naval_fate --help
Naval Fate.

Usage:
  naval_fate ship new <name>...
  naval_fate ship <name> move <x> <y> [--speed=<kn>]
  naval_fate ship shoot <x> <y>
  naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
  naval_fate -h | --help
  naval_fate --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.
┌──> /tmp/naval_fate --help                                                                                                                                                                                                         
└─── cod: learn this command? [yn?] > y
cod: learned completions: "--speed=" "--moored" "--drifting" and 3 more

Only flag options are learned. However I'm not sure how wildly spread the docopt format actually is...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions