mirror of
https://github.com/go-task/task.git
synced 2025-03-19 21:17:46 +02:00
Merge pull request #330 from danquah/print-usage
Have the --help/-h flag print usage.
This commit is contained in:
commit
86be13ff1f
@ -50,6 +50,7 @@ func main() {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
versionFlag bool
|
versionFlag bool
|
||||||
|
helpFlag bool
|
||||||
init bool
|
init bool
|
||||||
list bool
|
list bool
|
||||||
status bool
|
status bool
|
||||||
@ -66,6 +67,7 @@ func main() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
|
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(&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.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")
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if helpFlag {
|
||||||
|
pflag.Usage()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if init {
|
if init {
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user