@marcel91200 / caddy Mirror · read-only / commits / ec2a5762
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 14:15 UTC

cmd: Don't print long help text on error

Matthew Holt committed Sep 1, 2022 at 21:41 UTC ec2a5762b03356aa3b59714d51fd969e9bf3f6e3
2 files changed +5 -4
cmd/cobra.go
+4
@@ -91,6 +91,10 @@ https://caddyserver.com/docs/running
91 $ caddy run --config caddy.json
92 $ caddy reload --config caddy.json
93 $ caddy stop`,
94 +
95 + // kind of annoying to have all the help text printed out if
96 + // caddy has an error provisioning its modules, for instance...
97 + SilenceUsage: true,
98 }
99
100 const fullDocsFooter = `Full documentation is available at:
cmd/main.go
+1 -4
@@ -51,12 +51,9 @@ func init() {
51 // Main implements the main function of the caddy command.
52 // Call this if Caddy is to be the main() of your program.
53 func Main() {
54 - switch len(os.Args) {
55 - case 0:
54 + if len(os.Args) == 0 {
55 fmt.Printf("[FATAL] no arguments provided by OS; args[0] must be command\n")
56 os.Exit(caddy.ExitCodeFailedStartup)
58 - case 1:
59 - os.Args = append(os.Args, "help")
57 }
58
59 if err := rootCmd.Execute(); err != nil {