添加 -n, --gitname 和 -e, --gitemail 参数

This commit is contained in:
陆柯 2019-10-25 10:15:26 +08:00
parent 8a7fca6223
commit 0840eb01c3
2 changed files with 11 additions and 5 deletions

View File

@ -4,12 +4,14 @@
* 如果是 git
* -r, --repo: 远程仓库,例如 'https://github.com/ORG/ORG.github.io'
* -b, --branch: 分支,默认为 master
* -n, --gitname
* -e, --gitemail
* 如果是 web
* -H, --host: 远程主机
* -P, --port: 远程端口,默认为 22
* -D, --dir: 远程目录,例如 /home/USER/FOLDER
* -D, --dir: 远程路径,例如 /home/USER/FOLDER
* -d, --dist: 远程文件夹,例如 www。默认为 dist。
* -l, --local: 本地文件夹,例如 ../../project/public。默认为 ./dist
* -l, --local: 本地路径,例如 ../../project/public。默认为 ./dist
* -u, --user: 用户名
* -p, --password: 密码
* -k, --key: 密钥文件

View File

@ -29,13 +29,15 @@ try {
commander
.version('1.0', '-v, --version') // 默认是 -V。如果要 -v就要加 '-v --version'
.option('-t, --type <type>', `Deploy to server type, web or git. Default to ${Config.deploy.type}`)
.option('-l, --local <local>', `Local path to copy from. Default to ${Config.deploy.local}`)
.option('-H, --host <host>', `Host IP or domain name of the target server. Default to ${Config.deploy.host}`)
.option('-P, --port <port>', `Ssh port number of the target server. Default to ${Config.deploy.port}`)
.option('-D, --dir <dir>', `Directory to deploy on the target server. Default to ${Config.deploy.dir}`)
.option('-d, --dist <dist>', `Folder to deploy on the target server. Default to ${Config.deploy.dist}`)
.option('-D, --dir <dir>', `Destination path to deploy on the target server. Default to ${Config.deploy.dir}`)
.option('-d, --dist <dist>', `Destination folder to deploy on the target server. Default to ${Config.deploy.dist}`)
.option('-r, --repo <repo>', `git repo address. Default to ${Config.deploy.repo}`)
.option('-b, --branch <branch', `git repo branch. Default to ${Config.deploy.branch}`)
.option('-l, --local <local>', `Local folder to copy from. Default to ${Config.deploy.local}`)
.option('-n, --gitname <name>', `git user name. Default to ${Config.deploy.gitname}`)
.option('-e, --gitemail <email>', `git user email. Default to ${Config.deploy.gitemail}`)
.option('-u, --user <user>', `User id to login the target server. Default to ${Config.deploy.user}`)
.option('-k, --key <key>', `User private key file to login the target server. Default to ${Config.deploy.key}`)
.option('-p, --password <password>', `User password to login the target server. You may have to enclose it in "". Default to "${Config.deploy.password}"`)
@ -51,6 +53,8 @@ const connection = {
dist: commander.dist || Config.deploy.dist || 'dist', // 新系统将发布在这个文件夹里。建议为dist和npm run build产生的目录一致这样既可以远程自动部署也可以直接登录服务器手动部署。
repo: commander.repo || Config.deploy.repo,
branch: commander.branch || Config.deploy.branch || 'master',
gitname: commander.gitname || Config.deploy.gitname,
gitemail: commander.gitemail || Config.deploy.gitemail,
local: commander.local || Config.deploy.local || './dist',
username: commander.user || Config.deploy.user,
privateKey: fs.existsSync(privateKeyFile) ? privateKeyFile : undefined,