Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "sort"
  6.  
  7. "github.com/docopt/docopt-go"
  8. )
  9.  
  10. func usage() string {
  11. usage := `Usage:
  12. pdfq get <file> <key>
  13. pdfq set <file> <key> <value>`
  14. return usage
  15. }
  16.  
  17. func main() {
  18.  
  19. // parse the command line `comfig_example tcp 127.0.0.1 --force`
  20. argv := []string{"get", "7600A.pdf", "requesting_agency_address"}
  21. arguments, _ := docopt.Parse(usage(), argv, true, "v0.1.1", false)
  22. // sort the keys of the arguments map
  23. var keys []string
  24. for k := range arguments {
  25. keys = append(keys, k)
  26. }
  27. sort.Strings(keys)
  28. // print the argument keys and values
  29. for _, k := range keys {
  30. fmt.Printf("%9s %v\n", k, arguments[k])
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement