Add EnableWindowsMouseTrap variable again (removed in commit 193b182195)

This commit is contained in:
José Luis Ledesma 2017-01-17 14:25:22 +01:00
parent 1dd5ff2e11
commit a25becd535
2 changed files with 9 additions and 4 deletions

View file

@ -45,6 +45,9 @@ var EnablePrefixMatching = false
// To disable sorting, set it to false.
var EnableCommandSorting = true
// EnableWindowsMouseTrap enables an information splash screen on Windows if the CLI is started from explorer.exe.
var EnableWindowsMouseTrap = true
// AddTemplateFunc adds a template function that's available to Usage and Help
// template generation.
func AddTemplateFunc(name string, tmplFunc interface{}) {

View file

@ -18,9 +18,11 @@ You need to open cmd.exe and run it from there.
`
func preExecHook(c *Command) {
if mousetrap.StartedByExplorer() {
c.Print(MousetrapHelpText)
time.Sleep(5 * time.Second)
os.Exit(1)
if EnableWindowsMouseTrap {
if mousetrap.StartedByExplorer() {
c.Print(MousetrapHelpText)
time.Sleep(5 * time.Second)
os.Exit(1)
}
}
}