|
@@ -79,29 +79,29 @@ func main() {
|
|
flags := appOptions.Parse()
|
|
flags := appOptions.Parse()
|
|
|
|
|
|
// apply flags
|
|
// apply flags
|
|
- t, _ := maps.String(&flags, "", "template")
|
|
|
|
|
|
+ t, _ := maps.String(flags, "", "template")
|
|
if tmpl, err := template.ParseFiles(t); err != nil {
|
|
if tmpl, err := template.ParseFiles(t); err != nil {
|
|
staticmd.Logger.Error("Failed to open template: %s", err)
|
|
staticmd.Logger.Error("Failed to open template: %s", err)
|
|
os.Exit(1)
|
|
os.Exit(1)
|
|
} else {
|
|
} else {
|
|
staticmd.Template = *tmpl
|
|
staticmd.Template = *tmpl
|
|
}
|
|
}
|
|
- staticmd.Input, _ = maps.String(&flags, staticmd.Input, "input")
|
|
|
|
- staticmd.Output, _ = maps.String(&flags, staticmd.Output, "output")
|
|
|
|
- staticmd.Book, _ = maps.Bool(&flags, staticmd.Book, "book")
|
|
|
|
- staticmd.Relative, _ = maps.Bool(&flags, staticmd.Relative, "relative")
|
|
|
|
|
|
+ staticmd.Input, _ = maps.String(flags, staticmd.Input, "input")
|
|
|
|
+ staticmd.Output, _ = maps.String(flags, staticmd.Output, "output")
|
|
|
|
+ staticmd.Book, _ = maps.Bool(flags, staticmd.Book, "book")
|
|
|
|
+ staticmd.Relative, _ = maps.Bool(flags, staticmd.Relative, "relative")
|
|
|
|
|
|
// sanitize input & output
|
|
// sanitize input & output
|
|
staticmd.Input, _ = filepath.Abs(staticmd.Input)
|
|
staticmd.Input, _ = filepath.Abs(staticmd.Input)
|
|
staticmd.Output, _ = filepath.Abs(staticmd.Output)
|
|
staticmd.Output, _ = filepath.Abs(staticmd.Output)
|
|
|
|
|
|
// optionally enable debugging
|
|
// optionally enable debugging
|
|
- if debug, _ := maps.Bool(&flags, false, "debug"); debug {
|
|
|
|
|
|
+ if debug, _ := maps.Bool(flags, false, "debug"); debug {
|
|
staticmd.Logger.Severity = log.Debug
|
|
staticmd.Logger.Severity = log.Debug
|
|
}
|
|
}
|
|
|
|
|
|
// optionally enable profiling
|
|
// optionally enable profiling
|
|
- if profile, _ := maps.String(&flags, "", "profile"); profile != "" {
|
|
|
|
|
|
+ if profile, _ := maps.String(flags, "", "profile"); profile != "" {
|
|
f, _ := os.Create(profile)
|
|
f, _ := os.Create(profile)
|
|
pprof.StartCPUProfile(f)
|
|
pprof.StartCPUProfile(f)
|
|
defer pprof.StopCPUProfile()
|
|
defer pprof.StopCPUProfile()
|