cobra/command_win.go
Albert Nigmatzianov c46add8a65 Add ability to disable mousetrap
Fix #486
Close #383 (no progress there)
2017-07-11 14:08:33 +02:00

21 lines
305 B
Go

// +build windows
package cobra
import (
"os"
"time"
"github.com/inconshreveable/mousetrap"
)
var preExecHookFn = preExecHook
func preExecHook(c *Command) {
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
c.Print(MousetrapHelpText)
time.Sleep(5 * time.Second)
os.Exit(1)
}
}