2016-07-26 01:30:28 +05:30
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package cobra
|
|
|
|
|
|
|
|
import (
|
2019-07-31 11:39:38 +05:30
|
|
|
"fmt"
|
2016-07-26 01:30:28 +05:30
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/inconshreveable/mousetrap"
|
|
|
|
)
|
|
|
|
|
|
|
|
var preExecHookFn = preExecHook
|
|
|
|
|
|
|
|
func preExecHook(c *Command) {
|
2019-07-31 11:39:38 +05:30
|
|
|
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
2016-07-26 01:30:28 +05:30
|
|
|
c.Print(MousetrapHelpText)
|
2019-07-31 11:39:38 +05:30
|
|
|
if MousetrapDisplayDuration > 0 {
|
|
|
|
time.Sleep(MousetrapDisplayDuration)
|
|
|
|
} else {
|
|
|
|
c.Println("Press return to continue...")
|
|
|
|
fmt.Scanln()
|
|
|
|
}
|
2016-07-26 01:30:28 +05:30
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|