fix(gonf): fixed gonf -help fd output and return code to not error
This commit is contained in:
parent
aad0157b42
commit
bae2d26671
3 changed files with 8 additions and 3 deletions
|
@ -12,7 +12,7 @@ func (env *Env) cmdBuild() error {
|
||||||
where FLAG can be one or more of`, flag.ContinueOnError)
|
where FLAG can be one or more of`, flag.ContinueOnError)
|
||||||
hostFlag := env.addHostFlag()
|
hostFlag := env.addHostFlag()
|
||||||
env.flagSet.SetOutput(env.stderr)
|
env.flagSet.SetOutput(env.stderr)
|
||||||
env.flagSet.Parse(env.args)
|
_ = env.flagSet.Parse(env.args)
|
||||||
if env.helpMode {
|
if env.helpMode {
|
||||||
env.flagSet.SetOutput(env.stdout)
|
env.flagSet.SetOutput(env.stdout)
|
||||||
env.flagSet.Usage()
|
env.flagSet.Usage()
|
||||||
|
|
|
@ -11,7 +11,7 @@ func (env *Env) cmdDeploy() error {
|
||||||
where FLAG can be one or more of`, flag.ContinueOnError)
|
where FLAG can be one or more of`, flag.ContinueOnError)
|
||||||
hostFlag := env.addHostFlag()
|
hostFlag := env.addHostFlag()
|
||||||
env.flagSet.SetOutput(env.stderr)
|
env.flagSet.SetOutput(env.stderr)
|
||||||
env.flagSet.Parse(env.args)
|
_ = env.flagSet.Parse(env.args)
|
||||||
if env.helpMode {
|
if env.helpMode {
|
||||||
env.flagSet.SetOutput(env.stdout)
|
env.flagSet.SetOutput(env.stdout)
|
||||||
env.flagSet.Usage()
|
env.flagSet.Usage()
|
||||||
|
|
|
@ -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.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.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.SetOutput(env.stderr)
|
||||||
env.flagSet.Parse(env.args[1:])
|
_ = env.flagSet.Parse(env.args[1:])
|
||||||
|
|
||||||
if env.flagSet.NArg() < 1 {
|
if env.flagSet.NArg() < 1 {
|
||||||
|
if env.helpMode {
|
||||||
|
env.flagSet.SetOutput(env.stdout)
|
||||||
|
env.flagSet.Usage()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
env.flagSet.Usage()
|
env.flagSet.Usage()
|
||||||
return fmt.Errorf("no command given")
|
return fmt.Errorf("no command given")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue