From 0a534c62bdf8980bf708782a74732333feccc34d Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 24 Aug 2025 11:07:04 +0200 Subject: [PATCH] Add help output --- tesseract/genconf/main.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tesseract/genconf/main.go b/tesseract/genconf/main.go index 98b530d..59f6ed7 100644 --- a/tesseract/genconf/main.go +++ b/tesseract/genconf/main.go @@ -131,7 +131,7 @@ func main() { args := flag.Args() if len(args) == 0 { - showConfig(*configFile) + showHelp() return } @@ -142,6 +142,7 @@ func main() { generateEnv(*configFile) default: fmt.Fprintf(os.Stderr, "Unknown command: %s\n", args[0]) + showHelp() os.Exit(1) } } @@ -160,6 +161,19 @@ func loadConfig(yamlFile string) Config { return config } +func showHelp() { + fmt.Printf("Usage: %s [options] \n\n", os.Args[0]) + fmt.Printf("Options:\n") + fmt.Printf(" -c Path to YAML configuration file (default: ./tesseract-staging.yaml)\n\n") + fmt.Printf("Commands:\n") + fmt.Printf(" gen-html Generate index.html and log.v3.json files in each log's localdirectory.\n") + fmt.Printf(" Creates HTML pages with log information and CT log metadata JSON.\n") + fmt.Printf(" Computes LOG_ID and public keys from private keys.\n\n") + fmt.Printf(" gen-env Generate .env files and combined roots.pem in each log's localdirectory.\n") + fmt.Printf(" Creates TESSERACT_ARGS environment variable with command line flags.\n") + fmt.Printf(" Combines global roots and log-specific extraroots into roots.pem.\n\n") +} + func showConfig(yamlFile string) { config := loadConfig(yamlFile)