简单介绍

这个包只能在windows下使用,就是判断cli命令行程序是否直接双击了,如果双击给出提示,否则就会闪一下不见了.

代码示例

"github.com/inconshreveable/mousetrap" //是否双击打开
if mousetrap.StartedByExplorer(){
        fmt.Print("`This is a command line tool\nYou need to open cmd.exe and run it from there.")
        time.Sleep(5*time.Second)
        os.Exit(1)
    }