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 := NewConfig() if err := cfg.Load("config.ini"); err != nil { return err } if err := cfg.LoadTemplates("layouts"); 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 }