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