arguments_example.go 645 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/docopt/docopt-go"
  5. )
  6. func main() {
  7. usage := `Usage: arguments_example [-vqrh] [FILE] ...
  8. arguments_example (--left | --right) CORRECTION FILE
  9. Process FILE and optionally apply correction to either left-hand side or
  10. right-hand side.
  11. Arguments:
  12. FILE optional input file
  13. CORRECTION correction angle, needs FILE, --left or --right to be present
  14. Options:
  15. -h --help
  16. -v verbose mode
  17. -q quiet mode
  18. -r make report
  19. --left use left-hand side
  20. --right use right-hand side`
  21. arguments, _ := docopt.Parse(usage, nil, true, "", false)
  22. fmt.Println(arguments)
  23. }