2016-01-15 18:48:03 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
2016-01-15 18:53:01 +00:00
|
|
|
"github.com/inconshreveable/mousetrap"
|
2016-01-15 18:48:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
2018-05-04 21:39:27 +00:00
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
2016-01-15 18:48:03 +00:00
|
|
|
c.Print(MousetrapHelpText)
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|