mirror of https://github.com/caddyserver/caddy.git
cmd: Don't print long help text on error
This commit is contained in:
parent
e77992dd99
commit
ec2a5762b0
|
@ -91,6 +91,10 @@ https://caddyserver.com/docs/running
|
||||||
$ caddy run --config caddy.json
|
$ caddy run --config caddy.json
|
||||||
$ caddy reload --config caddy.json
|
$ caddy reload --config caddy.json
|
||||||
$ caddy stop`,
|
$ caddy stop`,
|
||||||
|
|
||||||
|
// kind of annoying to have all the help text printed out if
|
||||||
|
// caddy has an error provisioning its modules, for instance...
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullDocsFooter = `Full documentation is available at:
|
const fullDocsFooter = `Full documentation is available at:
|
||||||
|
|
|
@ -51,12 +51,9 @@ func init() {
|
||||||
// Main implements the main function of the caddy command.
|
// Main implements the main function of the caddy command.
|
||||||
// Call this if Caddy is to be the main() of your program.
|
// Call this if Caddy is to be the main() of your program.
|
||||||
func Main() {
|
func Main() {
|
||||||
switch len(os.Args) {
|
if len(os.Args) == 0 {
|
||||||
case 0:
|
|
||||||
fmt.Printf("[FATAL] no arguments provided by OS; args[0] must be command\n")
|
fmt.Printf("[FATAL] no arguments provided by OS; args[0] must be command\n")
|
||||||
os.Exit(caddy.ExitCodeFailedStartup)
|
os.Exit(caddy.ExitCodeFailedStartup)
|
||||||
case 1:
|
|
||||||
os.Args = append(os.Args, "help")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue