Skip to content

Commit 86be13f

Browse files
authored
Merge pull request #330 from danquah/print-usage
Have the --help/-h flag print usage.
2 parents ee95df0 + 739037f commit 86be13f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/task/task.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func main() {
5050

5151
var (
5252
versionFlag bool
53+
helpFlag bool
5354
init bool
5455
list bool
5556
status bool
@@ -66,6 +67,7 @@ func main() {
6667
)
6768

6869
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
70+
pflag.BoolVarP(&helpFlag, "help", "h", false, "shows Task usage")
6971
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder")
7072
pflag.BoolVarP(&list, "list", "l", false, "lists tasks with description of current Taskfile")
7173
pflag.BoolVar(&status, "status", false, "exits with non-zero exit code if any of the given tasks is not up-to-date")
@@ -86,6 +88,11 @@ func main() {
8688
return
8789
}
8890

91+
if helpFlag {
92+
pflag.Usage()
93+
return
94+
}
95+
8996
if init {
9097
wd, err := os.Getwd()
9198
if err != nil {

0 commit comments

Comments
 (0)