This commit is contained in:
Jose Luis Ledesma 2017-06-29 12:48:13 +00:00 committed by GitHub
commit 73d0d99ba7
2 changed files with 9 additions and 4 deletions

View file

@ -47,6 +47,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)
}
}
}