2019-01-12 04:58:27 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
2019-09-27 21:51:53 +00:00
|
|
|
"fmt"
|
2019-01-12 04:58:27 +00:00
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/inconshreveable/mousetrap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
|
|
|
c.Print(MousetrapHelpText)
|
2019-09-27 21:51:53 +00:00
|
|
|
if MousetrapDisplayDuration > 0 {
|
|
|
|
time.Sleep(MousetrapDisplayDuration)
|
|
|
|
} else {
|
|
|
|
c.Println("Press return to continue...")
|
|
|
|
fmt.Scanln()
|
|
|
|
}
|
2019-01-12 04:58:27 +00:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|