rename toTarget to gotoTarget

This commit is contained in:
陆柯 2021-07-01 20:21:26 +08:00
parent 23c98bcd00
commit 6168e3ed33

View File

@ -10,7 +10,7 @@ const wo = { global.wo = {
envi: {
deploy: {
fromDist: './dist',
toTarget: 'github',
gotoTarget: 'github',
vultr: {
targetType: 'ssh',
@ -46,15 +46,15 @@ try {
} catch (err) {
console.error('Loading config files failed: ' + err.message)
}
wo.envi.deploy.connection = wo.envi.deploy[wo.envi.deploy.toTarget]
wo.envi.deploy.connection = wo.envi.deploy[wo.envi.deploy.gotoTarget]
// 读取命令行参数
commander
.version('1.0', '-v, --version') // 默认是 -V。如果要 -v就要加 '-v --version'
.option('-f, --fromDist <fromDist>', `local distribution path to copy from. Default to ${wo.envi.deploy.fromDist}`)
.option('-t, --toTarget <toTarget>', `connection section in config. Default to ${wo.envi.deploy.toTarget}`)
.option('-g, --gotoTarget <gotoTarget>', `connection section in config. Default to ${wo.envi.deploy.gotoTarget}`)
.option('-T, --targetType <targetType>', `target type, git or ssh. Default to ${wo.envi.deploy.connection.targetType}`)
.option('-t, --targetType <targetType>', `target type, git or ssh. Default to ${wo.envi.deploy.connection.targetType}`)
.option('-H, --host <host>', `Host IP or domain name of the target server. Default to ${wo.envi.deploy.connection.host}`)
.option('-P, --port <port>', `Ssh port number of the target server. Default to ${wo.envi.deploy.connection.port}`)
@ -64,7 +64,7 @@ commander
.option('-r, --repo <repo>', `git repo address. Default to ${wo.envi.deploy.connection.repo}`)
.option('-b, --branch <branch>', `git repo branch. Default to ${wo.envi.deploy.connection.branch}`)
.option('-n, --gitname <gitname>', `git user name. Default to ${wo.envi.deploy.connection.gitname}`)
.option('-e, --gitemail <gitemail>', `git user email. Default to ${wo.envi.deploy.connection.gitemail}`)
.option('-m, --gitemail <gitemail>', `git user email. Default to ${wo.envi.deploy.connection.gitemail}`)
.option('-u, --user <user>', `User id to login the target server. Default to ${wo.envi.deploy.connection.user}`)
.option('-k, --key <key>', `User private key file to login the target server. Default to ${wo.envi.deploy.connection.key}`)
@ -73,7 +73,7 @@ commander
wo.envi.deploy.fromDist = commander.fromDist || wo.envi.deploy.fromDist
wo.envi.deploy.connection = wo.envi.deploy[commander.toTarget || wo.envi.deploy.toTarget] // 使用用户指定的连接
wo.envi.deploy.connection = wo.envi.deploy[commander.gotoTarget || wo.envi.deploy.gotoTarget] // 使用用户指定的连接
// 可以用命令行参数覆盖掉配置文件
const connection = {
targetType: commander.targetType || wo.envi.deploy.connection.targetType,