Skip to content

Commit

Permalink
Separate mandatory from non-mandatory flags
Browse files Browse the repository at this point in the history
  • Loading branch information
bertfrees committed Feb 5, 2019
1 parent d68b524 commit c39f7e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ Admin commands:
List of global options: {{.Name}} help -g
Detailed help for a single command: {{.Name}} help COMMAND
`
//TODO: Check if required options to write/ignore []
COMMAND_HELP_TEMPLATE = `
Usage: {{.Parent.Name}} [GLOBAL_OPTIONS] {{.Name}} [OPTIONS] {{ .Arity.Description}}
Usage: {{.Parent.Name}} [GLOBAL_OPTIONS] {{.Name}}{{if .MandatoryFlags}} REQUIRED_OPTIONS{{end}}{{if .MandatoryFlags}} [OPTIONS]{{end}} {{ .Arity.Description}}
{{.Description}}
{{if .Flags}}
Options:
{{range .Flags }} {{flagAligner .FlagStringPrefix}} {{.ShortDesc}}
{{end}}
{{end}}
{{if .MandatoryFlags}}Required options:
{{range .MandatoryFlags }} {{flagAligner .FlagStringPrefix}} {{.ShortDesc}}
{{end}}{{end}}
{{if .NonMandatoryFlags}}{{if .MandatoryFlags}}Other options{{end}}{{if not .MandatoryFlags}}Options{{end}}:
{{range .NonMandatoryFlags }} {{flagAligner .FlagStringPrefix}} {{.ShortDesc}}
{{end}}{{end}}
`

Expand Down
1 change: 1 addition & 0 deletions cli/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func scriptToCommand(script pipeline.Script, cli *Cli, link *PipelineLink) (req
}
return nil
}, jobRequest)
command.SetArity(0, "")

for _, input := range script.Inputs {
name := getFlagName(input.Name, "i-", command.Flags())
Expand Down

0 comments on commit c39f7e3

Please sign in to comment.