| Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame] | 1 | // +build windows |
| 2 | |||||
| 3 | package cobra | ||||
| 4 | |||||
| 5 | import ( | ||||
| 6 | "os" | ||||
| 7 | "time" | ||||
| 8 | |||||
| 9 | "github.com/inconshreveable/mousetrap" | ||||
| 10 | ) | ||||
| 11 | |||||
| 12 | var preExecHookFn = preExecHook | ||||
| 13 | |||||
| 14 | func preExecHook(c *Command) { | ||||
| 15 | if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { | ||||
| 16 | c.Print(MousetrapHelpText) | ||||
| 17 | time.Sleep(5 * time.Second) | ||||
| 18 | os.Exit(1) | ||||
| 19 | } | ||||
| 20 | } | ||||