mirror of
https://github.com/go-task/task.git
synced 2025-01-06 03:53:54 +02:00
Have the --help/-h flag print usage.
pflag will output a "pflag: help requested" message after displaying the usage if we don't explicitly handle the flag.
This commit is contained in:
parent
116879f7ea
commit
739037fc37
@ -49,6 +49,7 @@ func main() {
|
||||
|
||||
var (
|
||||
versionFlag bool
|
||||
helpFlag bool
|
||||
init bool
|
||||
list bool
|
||||
status bool
|
||||
@ -65,6 +66,7 @@ func main() {
|
||||
)
|
||||
|
||||
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
|
||||
pflag.BoolVarP(&helpFlag, "help", "h", false, "shows Task usage")
|
||||
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder")
|
||||
pflag.BoolVarP(&list, "list", "l", false, "lists tasks with description of current Taskfile")
|
||||
pflag.BoolVar(&status, "status", false, "exits with non-zero exit code if any of the given tasks is not up-to-date")
|
||||
@ -85,6 +87,11 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if helpFlag {
|
||||
pflag.Usage()
|
||||
return
|
||||
}
|
||||
|
||||
if init {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user