2016-10-31 16:50:02 +01:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
2019-04-13 14:47:57 +02:00
|
|
|
"fmt"
|
2016-10-31 16:50:02 +01:00
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/inconshreveable/mousetrap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
2017-07-23 09:51:42 +02:00
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
2016-10-31 16:50:02 +01:00
|
|
|
c.Print(MousetrapHelpText)
|
2019-04-13 14:47:57 +02:00
|
|
|
if MousetrapDisplayDuration > 0 {
|
|
|
|
time.Sleep(MousetrapDisplayDuration)
|
|
|
|
} else {
|
|
|
|
c.Println("Press return to continue...")
|
|
|
|
fmt.Scanln()
|
|
|
|
}
|
2016-10-31 16:50:02 +01:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|