fix: print usage to err instead of out

This commit is contained in:
2025-12-28 16:38:40 -05:00
parent c43e905729
commit 5fabd0233d

12
main.go
View File

@@ -34,13 +34,13 @@ func init() {
func main() { func main() {
flag.Usage = func() { flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options] <command> <project_dir>\n", os.Args[0]) fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options] <command> <project_dir>\n", os.Args[0])
fmt.Println("Commands:") fmt.Fprintf(os.Stderr, "Commands:")
fmt.Println(" new <project_dir> Create a new project") fmt.Fprintf(os.Stderr, " new <project_dir> Create a new project")
fmt.Println(" doc Open documentation") fmt.Fprintf(os.Stderr, " doc Open documentation")
fmt.Println(" run <project_dir> Start the server") fmt.Fprintf(os.Stderr, " run <project_dir> Start the server")
fmt.Println("Options:") fmt.Fprintf(os.Stderr, "Options:")
flag.PrintDefaults() flag.PrintDefaults()
fmt.Println("For bug reports, contact a developer and describe the issue. Provide the output of the `-V1` flag.") fmt.Fprintf(os.Stderr, "For bug reports, contact a developer and describe the issue. Provide the output of the `-V1` flag.")
} }
showVersion := flag.Bool("version", false, "Show version and exit") showVersion := flag.Bool("version", false, "Show version and exit")