aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/github.com/spf13/cobra/command_win.go
blob: 8768b1736dca3416e88b57898376f418c9ab1a62 (plain) (tree)
1
2
3
4
5
6




                 
             










                                                                     





                                                                


                          
// +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)
	}
}