1 Star 1 Fork 0

jobily/fiora

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.ts 2.37 KB
一键复制 编辑 原始数据 按行查看 历史
碎碎酱 提交于 2021-07-27 22:00 . Use local ts-node instead global
#!/usr/bin/env ./node_modules/.bin/ts-node
import { program } from 'commander';
import cp from 'child_process';
import i18n from './packages/i18n/node.index';
function exec(commandStr: string) {
const [command, ...args] = commandStr.split(' ');
cp.execFileSync(command, args, { stdio: 'inherit' });
}
program
.command('getUserId <username>')
.description(i18n('getUserIdDescription'))
.action((username: string) => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts getUserId ${username}`,
);
});
program
.command('register <username> <password>')
.description(i18n('registerDescription'))
.action((username: string, password: string) => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts register ${username} ${password}`,
);
});
program
.command('deleteUser <userId>')
.description(i18n('deleteUserDescription'))
.action((userId: string) => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts deleteUser ${userId}`,
);
});
program
.command('fixUsersAvatar [searchValue] [replaceValue]')
.description(i18n('fixUsersAvatarDescription'))
.action((searchValue = '', replaceValue = '') => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts fixUsersAvatar ${searchValue} ${replaceValue}`,
);
});
program
.command('deleteTodayRegisteredUsers')
.description(i18n('deleteTodayRegisteredUsersDescription'))
.action(() => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts deleteTodayRegisteredUsers`,
);
});
program
.command('deleteMessages')
.description(i18n('deleteMessagesDescription'))
.action(() => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts deleteMessages`,
);
});
program
.command('updateDefaultGroupName <newName>')
.description(i18n('updateDefaultGroupNameDescription'))
.action((newName: string) => {
exec(
`npx ts-node --transpile-only packages/bin/index.ts updateDefaultGroupName ${newName}`,
);
});
program
.command('doctor')
.description(i18n('doctorDescription'))
.action(() => {
exec(`npx ts-node --transpile-only packages/bin/index.ts doctor`);
});
program.usage('[command]');
program.parse(process.argv);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hubo/fiora.git
git@gitee.com:hubo/fiora.git
hubo
fiora
fiora
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385