You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.6 KiB

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