1 Star 7 Fork 4

惊悚的毛毛虫 / nodejs_git_tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.js 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
惊悚的毛毛虫 提交于 2021-06-01 10:04 . 修改
const GitTools = require('./lib/gitTools.js');
const inquirer = require('./lib/inquirerTools.js');
// 注意此处目录需要 \\ 否则将会报错
var git = new GitTools(`D:\\WebProject\\byf_web_core_multi_page`);
const options = {
'checkout (切分支)': 'checkout',
'pull (拉取代码)': 'pull',
'add (添加暂存区)': 'add',
'commit (提交)': 'commit',
'push (推送)': 'push',
'status (修改状态)': 'status',
'branch (查看分支)': 'branch',
'switchBreach (切换分支并拉取最新代码)': 'switchBreach',
'自动推送': 'autoUpload',
}
const filterInput = ['add','status','branch'];
async function main() {
console.clear();
try {
console.log('--- git Tools 示例操作 --- ');
console.log()
let type = await inquirer.list('请选择你要进行的操作', Object.keys(options));
type = options[type];
let result = ''
if (!filterInput.some(item=>item == type)) {
result = await inquirer.input(type == 'commit' ? '请输入备注信息' : '请输入分支名称')
}
let data = await git[type](result);
console.log('--- 操作完毕 --- ',data);
console.log()
let isReset = await inquirer.confirm('是否需要重新选择?');
if(isReset){
main();
}
} catch (err) {
console.error('流程错误:', err);
}
}
main();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ChenMuShan/nodejs_git_tools.git
git@gitee.com:ChenMuShan/nodejs_git_tools.git
ChenMuShan
nodejs_git_tools
nodejs_git_tools
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891