-
Notifications
You must be signed in to change notification settings - Fork 2
/
commandline.go
35 lines (25 loc) · 875 Bytes
/
commandline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"flag"
"fmt"
)
const FLAG_USAGE = `Usage of ascii-go:
-i, --input <file> The image to be converted
-o, --output <file> The result file
-c, --invert inverts the image colors
-h, --help prints this message
note: if no output file is given, the program prints to stdout
`
func cmdFlags() (string, string, bool) {
var input, output string
var inverted bool
flag.StringVar(&input, "input", "", "The image to be converted")
flag.StringVar(&output, "output", "", "The result file")
flag.BoolVar(&inverted, "invert", false, "Invert the colors of output")
flag.StringVar(&input, "i", "", "The image to be converted")
flag.StringVar(&output, "o", "", "The result file")
flag.BoolVar(&inverted, "c", false, "Invert the colors of output")
flag.Usage = func() { fmt.Print(FLAG_USAGE) }
flag.Parse()
return input, output, inverted
}