diff options
-rw-r--r-- | cmd/gonf/cmd_build.go | 2 | ||||
-rw-r--r-- | cmd/gonf/cmd_deploy.go | 2 | ||||
-rw-r--r-- | cmd/gonf/main.go | 7 |
3 files changed, 8 insertions, 3 deletions
diff --git a/cmd/gonf/cmd_build.go b/cmd/gonf/cmd_build.go index 92337db..17a1a93 100644 --- a/cmd/gonf/cmd_build.go +++ b/cmd/gonf/cmd_build.go @@ -12,7 +12,7 @@ func (env *Env) cmdBuild() error { where FLAG can be one or more of`, flag.ContinueOnError) hostFlag := env.addHostFlag() env.flagSet.SetOutput(env.stderr) - env.flagSet.Parse(env.args) + _ = env.flagSet.Parse(env.args) if env.helpMode { env.flagSet.SetOutput(env.stdout) env.flagSet.Usage() diff --git a/cmd/gonf/cmd_deploy.go b/cmd/gonf/cmd_deploy.go index d956af2..2bc07ad 100644 --- a/cmd/gonf/cmd_deploy.go +++ b/cmd/gonf/cmd_deploy.go @@ -11,7 +11,7 @@ func (env *Env) cmdDeploy() error { where FLAG can be one or more of`, flag.ContinueOnError) hostFlag := env.addHostFlag() env.flagSet.SetOutput(env.stderr) - env.flagSet.Parse(env.args) + _ = env.flagSet.Parse(env.args) if env.helpMode { env.flagSet.SetOutput(env.stdout) env.flagSet.Usage() diff --git a/cmd/gonf/main.go b/cmd/gonf/main.go index 606beb5..0472350 100644 --- a/cmd/gonf/main.go +++ b/cmd/gonf/main.go @@ -41,9 +41,14 @@ where FLAG can be one or more of`, flag.ContinueOnError) env.flagSet.BoolVar(&env.helpMode, "help", false, "show contextual help") env.flagSet.StringVar(&env.configDir, "config", "", "(REQUIRED for most commands) path to a gonf configurations repository (overrides the GONF_CONFIG environment variable)") env.flagSet.SetOutput(env.stderr) - env.flagSet.Parse(env.args[1:]) + _ = env.flagSet.Parse(env.args[1:]) if env.flagSet.NArg() < 1 { + if env.helpMode { + env.flagSet.SetOutput(env.stdout) + env.flagSet.Usage() + return nil + } env.flagSet.Usage() return fmt.Errorf("no command given") } |