1
0
mirror of https://github.com/go-task/task.git synced 2025-03-17 21:08:01 +02:00

Merge pull request #330 from danquah/print-usage

Have the --help/-h flag print usage.
This commit is contained in:
Andrey Nering 2020-05-14 21:15:00 -03:00 committed by GitHub
commit 86be13ff1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,7 @@ func main() {
var (
versionFlag bool
helpFlag bool
init bool
list bool
status bool
@ -66,6 +67,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")
@ -86,6 +88,11 @@ func main() {
return
}
if helpFlag {
pflag.Usage()
return
}
if init {
wd, err := os.Getwd()
if err != nil {