summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/cobra/command_win.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/cobra/command_win.go')
-rw-r--r--vendor/github.com/spf13/cobra/command_win.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go
new file mode 100644
index 000000000..4b0eaa1b6
--- /dev/null
+++ b/vendor/github.com/spf13/cobra/command_win.go
@@ -0,0 +1,26 @@
+// +build windows
+
+package cobra
+
+import (
+ "os"
+ "time"
+
+ "github.com/inconshreveable/mousetrap"
+)
+
+var preExecHookFn = preExecHook
+
+// enables an information splash screen on Windows if the CLI is started from explorer.exe.
+var MousetrapHelpText string = `This is a command line tool
+
+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)
+ }
+}