diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-10 19:47:52 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-10 19:47:52 +0200 |
commit | 7eac3c24255a86257d42ab38668cbd88dc96f55b (patch) | |
tree | 97d9da5e63c68949e7fb122c8c04c1a7845e04df /main.go | |
parent | 3521bff39c39ffc35c6b0cb65cac51591d51c8b9 (diff) |
Add the ‘-x’ command-line option
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -4,16 +4,26 @@ import ( "fmt" "os" + "git.thomasvoss.com/getgopt" "git.thomasvoss.com/gsp/formatter" "git.thomasvoss.com/gsp/parser" ) func main() { - if len(os.Args) == 1 { + for opt := byte(0); getgopt.Getopt(len(os.Args), os.Args, "x", &opt); { + switch opt { + case 'x': + parser.Xml = true + } + } + + os.Args = os.Args[getgopt.Optind:] + + if len(os.Args) == 0 { process("-") } - for _, arg := range os.Args[1:] { + for _, arg := range os.Args { process(arg) } } |