5 changed files with 133 additions and 36 deletions
@ -0,0 +1,87 @@ |
|||||
|
const inquirer = require('inquirer'); |
||||
|
|
||||
|
module.exports = { |
||||
|
isPushAll() { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
inquirer.prompt([{ |
||||
|
type: 'confirm', // 问题类型,包括input,number,confirm,list,rawlist,password
|
||||
|
name: 'all', |
||||
|
message: '是否提交所有源', // 问题
|
||||
|
default: true // 默认值
|
||||
|
}]).then(async answers => { |
||||
|
if (answers.all) { |
||||
|
resolve(true); |
||||
|
} else { |
||||
|
resolve(false); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
pushMsg() { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
inquirer.prompt([{ |
||||
|
type: 'input', |
||||
|
name: 'msg', |
||||
|
message: '请输入需要提交的消息', // 问题
|
||||
|
default: '', // 默认值
|
||||
|
validate: (input) => { |
||||
|
if (input.length == 0) { //
|
||||
|
return '消息不能为空' |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}]).then(async answers => { |
||||
|
if (answers.msg) { |
||||
|
resolve(answers.msg); |
||||
|
} else { |
||||
|
resolve(''); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
listPush(origin) { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
inquirer.prompt([{ |
||||
|
type: 'checkbox', // 问题类型,包括input,number,confirm,list,rawlist,password
|
||||
|
choices: origin, |
||||
|
name: 'choices', |
||||
|
message: '请选择一个源提交', // 问题
|
||||
|
default: true // 默认值
|
||||
|
}]).then(async answers => { |
||||
|
resolve(answers.choices); |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
addRemote() { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
inquirer.prompt([{ |
||||
|
type: 'input', // 问题类型,包括input,number,confirm,list,rawlist,password
|
||||
|
name: 'name', |
||||
|
message: '源名字', // 问题
|
||||
|
default: '', // 默认值
|
||||
|
validate: (input) => { |
||||
|
if (input.length == 0) { |
||||
|
return '请输入源名字'; |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}, { |
||||
|
type: 'input', // 问题类型,包括input,number,confirm,list,rawlist,password
|
||||
|
name: 'url', |
||||
|
message: '源url', // 问题
|
||||
|
default: '', // 默认值
|
||||
|
validate: (input) => { |
||||
|
if (input.length == 0) { |
||||
|
return '请输入源url'; |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}]).then(async answers => { |
||||
|
resolve({ |
||||
|
name: answers.name, |
||||
|
url: answers.url |
||||
|
}); |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -1,6 +1,14 @@ |
|||||
## 自用的 请勿下载 |
## 自用的 请勿下载 |
||||
|
|
||||
|
|
||||
自用的 请勿下载, GIT一键多源提交 |
自用的 请勿下载, GIT一键多源提交 |
||||
|
|
||||
|
目前只用于`nodejs` |
||||
|
|
||||
|
V 1.0.5 |
||||
|
|
||||
|
`xyx sync`当前目录下提交所有存在的源 |
||||
|
|
||||
V 1.0.* |
V 1.0.* |
||||
|
|
||||
项目雏形,逐步完善,不升到版本2以上表示不能使用 |
项目雏形,逐步完善,不升到版本2以上表示不能使用 |
Loading…
Reference in new issue