fix: pack-deploy id -k <fileKey> 使用inquirer
This commit is contained in:
parent
c01820d1c6
commit
d0beea4b37
@ -9,6 +9,7 @@ import ignore from 'ignore';
|
|||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import { chalk } from '@/module/chalk.ts';
|
import { chalk } from '@/module/chalk.ts';
|
||||||
import * as backServices from '@/query/services/index.ts';
|
import * as backServices from '@/query/services/index.ts';
|
||||||
|
import inquirer from 'inquirer';
|
||||||
// 查找文件(忽略大小写)
|
// 查找文件(忽略大小写)
|
||||||
async function findFileInsensitive(targetFile: string): Promise<string | null> {
|
async function findFileInsensitive(targetFile: string): Promise<string | null> {
|
||||||
const files = fs.readdirSync('.');
|
const files = fs.readdirSync('.');
|
||||||
@ -341,7 +342,7 @@ const packCommand = new Command('pack')
|
|||||||
if (res.code === 200 && opts?.update) {
|
if (res.code === 200 && opts?.update) {
|
||||||
const id = res.data.id;
|
const id = res.data.id;
|
||||||
if (opts?.update) {
|
if (opts?.update) {
|
||||||
console.log(chalk.blue('example: '), 'envision pack-deploy', id, '<key>');
|
console.log(chalk.blue('example: '), 'envision pack-deploy', id, '-k <key>');
|
||||||
console.log('envision pack-deploy', id);
|
console.log('envision pack-deploy', id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,10 +354,21 @@ const packCommand = new Command('pack')
|
|||||||
});
|
});
|
||||||
const packDeployCommand = new Command('pack-deploy')
|
const packDeployCommand = new Command('pack-deploy')
|
||||||
.argument('<id>', 'id')
|
.argument('<id>', 'id')
|
||||||
.argument('<fileKey>', 'fileKey, 服务器的部署文件夹的列表')
|
.option('-k, --key <fileKey>', 'fileKey, 服务器的部署文件夹的列表')
|
||||||
.option('-f --force', 'force')
|
.option('-f --force', 'force')
|
||||||
.action(async (id, fileKey, opts) => {
|
.action(async (id, opts) => {
|
||||||
const { force } = opts || {};
|
let { force, fileKey } = opts || {};
|
||||||
|
if (!fileKey) {
|
||||||
|
const answers = await inquirer.prompt([
|
||||||
|
{
|
||||||
|
type: 'input',
|
||||||
|
name: 'fileKey',
|
||||||
|
message: 'Enter your deploy to services fileKey:',
|
||||||
|
when: () => !fileKey, // 当 username 为空时,提示用户输入
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
fileKey = answers.fileKey || fileKey;
|
||||||
|
}
|
||||||
const res = await deployLoadFn(id, fileKey, force);
|
const res = await deployLoadFn(id, fileKey, force);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user