p-ranav / argparse

Argument Parser for Modern C++
MIT License
2.72k stars 250 forks source link

parsing the demo on docopt.org with "argparse" #374

Open autorain opened 4 months ago

autorain commented 4 months ago

Could someone help how to implement the following command parsing using argparse:

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.

From http://docopt.org/. Thanks a lot.