Add help output

This commit is contained in:
Pim van Pelt
2025-08-24 11:07:04 +02:00
parent b6e458d012
commit 0a534c62bd

View File

@@ -131,7 +131,7 @@ func main() {
args := flag.Args() args := flag.Args()
if len(args) == 0 { if len(args) == 0 {
showConfig(*configFile) showHelp()
return return
} }
@@ -142,6 +142,7 @@ func main() {
generateEnv(*configFile) generateEnv(*configFile)
default: default:
fmt.Fprintf(os.Stderr, "Unknown command: %s\n", args[0]) fmt.Fprintf(os.Stderr, "Unknown command: %s\n", args[0])
showHelp()
os.Exit(1) os.Exit(1)
} }
} }
@@ -160,6 +161,19 @@ func loadConfig(yamlFile string) Config {
return config return config
} }
func showHelp() {
fmt.Printf("Usage: %s [options] <command>\n\n", os.Args[0])
fmt.Printf("Options:\n")
fmt.Printf(" -c <file> 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) { func showConfig(yamlFile string) {
config := loadConfig(yamlFile) config := loadConfig(yamlFile)