2015-11-23 23:19:32 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/inconshreveable/mousetrap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
2017-07-10 19:27:14 +00:00
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
2015-11-23 23:19:32 +00:00
|
|
|
c.Print(MousetrapHelpText)
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|