Skip to content

Commit

Permalink
add disable_help config
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuro9715 committed May 7, 2021
1 parent 3992625 commit 933fe53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ parse_end:
return
}

if helpFlag {
if helpFlag && !cfg.DisableHelp {
fprintHelp(os.Stdout, cfg)
code = 0
return
Expand All @@ -175,7 +175,7 @@ func findTask(i *int, nzargs []nzflag.Value, config *config.Config) (task *confi
i2 := *i
for ; i2 < len(nzargs); i2++ {
arg := nzargs[i2]
if isHelpFlag(arg.String()) {
if isHelpFlag(arg.String()) && !config.DisableHelp {
fprintTaskHelp(os.Stdout, task)
return nil, 0
}
Expand Down
13 changes: 7 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ func (v *Vars) UnmarshalYAML(data []byte) error {
}

type config struct {
Shell string `yaml:"shell"`
Default string `yaml:"default"`
Tasks Tasks `yaml:"tasks"`
Envs Envs `yaml:"env"`
Vars Vars `yaml:"var"`
Paths yaml.StringList `yaml:"path"`
Shell string `yaml:"shell"`
Default string `yaml:"default"`
Tasks Tasks `yaml:"tasks"`
Envs Envs `yaml:"env"`
Vars Vars `yaml:"var"`
Paths yaml.StringList `yaml:"path"`
DisableHelp bool `yaml:"disable_help"`
}

type Config struct {
Expand Down

0 comments on commit 933fe53

Please sign in to comment.