aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-10 20:19:26 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-09-10 20:20:00 +0200
commitadb23b20e8d2f360e9b20499bff10734890810ac (patch)
tree916aba7b040755d1e5cab033049f55e037ccf1b1 /main.go
parent7eac3c24255a86257d42ab38668cbd88dc96f55b (diff)
Remove all XML support
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/main.go b/main.go
index c805fec..96dd479 100644
--- a/main.go
+++ b/main.go
@@ -9,22 +9,27 @@ import (
"git.thomasvoss.com/gsp/parser"
)
+var dflag bool
+
func main() {
- for opt := byte(0); getgopt.Getopt(len(os.Args), os.Args, "x", &opt); {
+ for opt := byte(0); getgopt.Getopt(len(os.Args), os.Args, "d", &opt); {
switch opt {
- case 'x':
- parser.Xml = true
+ case 'd':
+ dflag = true
+ default:
+ fmt.Fprintf(os.Stderr, "Usage: %s [-d] [file ...]\n", os.Args[0])
+ os.Exit(1)
}
}
- os.Args = os.Args[getgopt.Optind:]
+ args := os.Args[getgopt.Optind:]
- if len(os.Args) == 0 {
+ if len(args) == 0 {
process("-")
}
- for _, arg := range os.Args {
- process(arg)
+ for _, a := range args {
+ process(a)
}
}
@@ -47,6 +52,9 @@ func process(filename string) {
die(err)
}
+ if !dflag {
+ fmt.Print("<!DOCTYPE html>")
+ }
formatter.PrintAst(ast)
fmt.Print("\n")
}