mirror of
https://github.com/spf13/cobra.git
synced 2024-11-15 09:48:19 -07:00
4fd30b69ee
* ci: test golang 1.16.x too * ci: style * ci: test golang 1.17.x too * bump go.mod to 1.15 * run gofmt
28 lines
452 B
Go
28 lines
452 B
Go
//go:build windows
|
|
// +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)
|
|
}
|
|
}
|