diff options
author | Julien Dessaux | 2024-09-17 09:57:29 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-09-17 09:57:29 +0200 |
commit | bae2d26671d87e97a6f8fd45db281103b5318623 (patch) | |
tree | da48ee39b108c4d5fd0cf8f9965b6ce686d3db0b /cmd | |
parent | chore(gonf): updated dependencies and fixed go.mod version (diff) | |
download | gonf-bae2d26671d87e97a6f8fd45db281103b5318623.tar.gz gonf-bae2d26671d87e97a6f8fd45db281103b5318623.tar.bz2 gonf-bae2d26671d87e97a6f8fd45db281103b5318623.zip |
fix(gonf): fixed gonf -help fd output and return code to not error
Diffstat (limited to '')
-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") } |