2022-05-02 15:05:18 +02:00
|
|
|
//go:build windows
|
2021-12-07 13:31:39 +01:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/inconshreveable/mousetrap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
|
|
|
c.Print(MousetrapHelpText)
|
|
|
|
if MousetrapDisplayDuration > 0 {
|
|
|
|
time.Sleep(MousetrapDisplayDuration)
|
|
|
|
} else {
|
|
|
|
c.Println("Press return to continue...")
|
|
|
|
fmt.Scanln()
|
|
|
|
}
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|