vue - check-versions.js for shell

本文介绍ShellJS,一个Node.js API之上的Unix shell命令的可移植实现,适用于Windows、Linux和OSX。文章展示了如何使用ShellJS检查系统是否安装了git,并在未安装时给出提示。

shelljs:https://www.npmjs.com/package/shelljs , 类似linux、unix、powser shell里面的命令.

 

ShellJS是Node.js API之上的Unix shell命令的可移植(Windows / Linux / OS X)实现.

 1 var shell = require('shelljs');
 2  
 3 if (!shell.which('git')) {
 4   shell.echo('Sorry, this script requires git');
 5   shell.exit(1);
 6 }
 7 
 8 
 9 
10 var shell = require('shelljs');
11  
12 if (!shell.which('git')) {
13   shell.echo('对不起,这个脚本需要git');
14   shell.exit(1);
15 }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值