golang包推荐判断windows是否双击了cli的程序-mousetrap
简单介绍
这个包只能在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)
}
- 原文作者:Yoby
- 原文链接:/2021/06/15/20210615-double.html
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),关于内容请通过关于我方式联系作者!