mirror of
https://github.com/go-task/task.git
synced 2026-06-26 14:16:16 +00:00
Use github.com/spf13/pflag instead of stdlib flag
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-task/task"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.CommandLine.Usage = func() {
|
||||
fmt.Println(`
|
||||
task [target1 target2 ...]: Runs commands under targets like make.
|
||||
pflag.Usage = func() {
|
||||
fmt.Println(`task [target1 target2 ...]: Runs commands under targets like make.
|
||||
|
||||
Example: 'task hello' with the following 'Taskfile.yml' file will generate
|
||||
an 'output.txt' file.
|
||||
@@ -23,8 +23,9 @@ hello:
|
||||
- output.txt
|
||||
'''
|
||||
`)
|
||||
pflag.PrintDefaults()
|
||||
}
|
||||
flag.BoolVar(&task.Force, "f", false, "forces execution even when the task is up-to-date")
|
||||
flag.Parse()
|
||||
pflag.BoolVarP(&task.Force, "force", "f", false, "forces execution even when the task is up-to-date")
|
||||
pflag.Parse()
|
||||
task.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user