package main import ( "flag" "log" ) func main() { if err := run(); err != nil { log.Fatal(err) } } func run() error { var format string flag.StringVar(&format, "format", "gemini", "output format to use. Supported formats include gemini and html") flag.Parse() // Load config cfg, err := LoadConfig("config.toml") if err != nil { return err } if err := cfg.LoadTemplates("templates"); err != nil { return err } var output Format switch format { case "gemini": output = FormatFunc(FormatGemini) case "html": output = FormatFunc(FormatHTML) default: log.Fatalf("unknown output format %q", format) } // Load content dir := NewDir("") if err := dir.read("content", ""); err != nil { return err } dir.sort() // Manipulate content if err := dir.manipulate(cfg); err != nil { return err } // Write content if err := dir.write("public", output, cfg); err != nil { return err } return nil }