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

flag to set directory of execution

This commit is contained in:
Andrey Nering 2017-07-30 19:24:53 -03:00
parent 09e84c2583
commit 7077b20a54

View File

@ -14,7 +14,7 @@ var (
version = "master" version = "master"
) )
const usage = `Usage: task [-ilfwvs] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [task...] const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [task...]
Runs the specified task(s). Falls back to the "default" task if no task name Runs the specified task(s). Falls back to the "default" task if no task name
was specified, or lists all tasks if an unknown task name was specified. was specified, or lists all tasks if an unknown task name was specified.
@ -50,6 +50,7 @@ func main() {
watch bool watch bool
verbose bool verbose bool
silent bool silent bool
dir string
) )
pflag.BoolVar(&versionFlag, "version", false, "show Task version") pflag.BoolVar(&versionFlag, "version", false, "show Task version")
@ -59,6 +60,7 @@ func main() {
pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task") pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task")
pflag.BoolVarP(&verbose, "verbose", "v", false, "enables verbose mode") pflag.BoolVarP(&verbose, "verbose", "v", false, "enables verbose mode")
pflag.BoolVarP(&silent, "silent", "s", false, "disables echoing") pflag.BoolVarP(&silent, "silent", "s", false, "disables echoing")
pflag.StringVarP(&dir, "dir", "d", "", "sets directory of execution")
pflag.Parse() pflag.Parse()
if versionFlag { if versionFlag {
@ -82,6 +84,7 @@ func main() {
Watch: watch, Watch: watch,
Verbose: verbose, Verbose: verbose,
Silent: silent, Silent: silent,
Dir: dir,
Stdin: os.Stdin, Stdin: os.Stdin,
Stdout: os.Stdout, Stdout: os.Stdout,