equal
deleted
inserted
replaced
1 // +build windows |
1 // +build windows |
2 |
2 |
3 package cobra |
3 package cobra |
4 |
4 |
5 import ( |
5 import ( |
|
6 "fmt" |
6 "os" |
7 "os" |
7 "time" |
8 "time" |
8 |
9 |
9 "github.com/inconshreveable/mousetrap" |
10 "github.com/inconshreveable/mousetrap" |
10 ) |
11 ) |
12 var preExecHookFn = preExecHook |
13 var preExecHookFn = preExecHook |
13 |
14 |
14 func preExecHook(c *Command) { |
15 func preExecHook(c *Command) { |
15 if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { |
16 if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { |
16 c.Print(MousetrapHelpText) |
17 c.Print(MousetrapHelpText) |
17 time.Sleep(5 * time.Second) |
18 if MousetrapDisplayDuration > 0 { |
|
19 time.Sleep(MousetrapDisplayDuration) |
|
20 } else { |
|
21 c.Println("Press return to continue...") |
|
22 fmt.Scanln() |
|
23 } |
18 os.Exit(1) |
24 os.Exit(1) |
19 } |
25 } |
20 } |
26 } |