| 1 | package mainscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp/cmd/test`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.11 fmt/" |
| 5 | |
| 6 | "github.com/tdewolff/argpscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/" |
| 7 | ) |
| 8 | |
| 9 | func mainscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp/cmd/test`/main().() { |
| 10 | var verbose int |
| 11 | var input string |
| 12 | var output string |
| 13 | var files []string |
| 14 | size := 512 // default value |
| 15 | |
| 16 | cmd := argpscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/.Newscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/New().("CLI tool description") |
| 17 | cmd.AddOptscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#AddOpt().(argpscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/.Countscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Count#{&verbose}, "v", "verbose", "Increase verbosity, eg. -vvv") |
| 18 | cmd.AddOptscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#AddOpt().(&output, "o", "output", "Output file name") |
| 19 | cmd.AddOptscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#AddOpt().(&size, "", "size", "Image size") |
| 20 | cmd.AddArgscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#AddArg().(&input, "input", "Input file name") |
| 21 | cmd.AddRestscip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#AddRest().(&files, "files", "Additional files") |
| 22 | cmd.Parsescip-go gomod github.com/tdewolff/argp . `github.com/tdewolff/argp`/Argp#Parse().() |
| 23 | |
| 24 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("verbose: %v\n", verbose) |
| 25 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("input: %q\n", input) |
| 26 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("output: %q\n", output) |
| 27 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("size: %v\n", size) |
| 28 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("files: []string{") |
| 29 | for i, file := range files { |
| 30 | if i > 0 { |
| 31 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printscip-go gomod github.com/golang/go/src go1.11 fmt/Print().(", ") |
| 32 | } |
| 33 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printfscip-go gomod github.com/golang/go/src go1.11 fmt/Printf().("%q", file) |
| 34 | } |
| 35 | fmtscip-go gomod github.com/golang/go/src go1.11 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.11 fmt/Println().("}") |
| 36 | } |