| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "github.com/docopt/docopt-go" |
| 6 | ) |
| 7 | |
| 8 | func main() { |
| 9 | usage := `Example of program with many options using docopt. |
| 10 | |
| 11 | Usage: |
| 12 | options [-hvqrf NAME] [--exclude=PATTERNS] |
| 13 | [--select=ERRORS | --ignore=ERRORS] [--show-source] |
| 14 | [--statistics] [--count] [--benchmark] PATH... |
| 15 | options (--doctest | --testsuite=DIR) |
| 16 | options --version |
| 17 | |
| 18 | Arguments: |
| 19 | PATH destination path |
| 20 | |
| 21 | Options: |
| 22 | -h --help show this help message and exit |
| 23 | --version show version and exit |
| 24 | -v --verbose print status messages |
| 25 | -q --quiet report only file names |
| 26 | -r --repeat show all occurrences of the same error |
| 27 | --exclude=PATTERNS exclude files or directories which match these comma |
| 28 | separated patterns [default: .svn,CVS,.bzr,.hg,.git] |
| 29 | -f NAME --file=NAME when parsing directories, only check filenames matching |
| 30 | these comma separated patterns [default: *.go] |
| 31 | --select=ERRORS select errors and warnings (e.g. E,W6) |
| 32 | --ignore=ERRORS skip errors and warnings (e.g. E4,W) |
| 33 | --show-source show source code for each error |
| 34 | --statistics count errors and warnings |
| 35 | --count print total number of errors and warnings to standard |
| 36 | error and set exit code to 1 if total is not null |
| 37 | --benchmark measure processing speed |
| 38 | --testsuite=DIR run regression tests from dir |
| 39 | --doctest run doctest on myself` |
| 40 | |
| 41 | arguments, _ := docopt.ParseArgs(usage, nil, "1.0.0rc2") |
| 42 | fmt.Println(arguments) |
| 43 | } |