esa-cli
Version:
A CLI for operating Alibaba Cloud ESA Functions and Pages.
30 lines (29 loc) • 913 B
JavaScript
import t from '../../i18n/index.js';
import addRoute from './add.js';
import deleteRoute from './delete.js';
import listRoute from './list.js';
let yargsIns;
const routeCommand = {
command: 'route [script]',
describe: `🚄 ${t('route_describe').d('Manage the routes bound to your project')}`,
builder: (yargs) => {
yargsIns = yargs;
return yargs
.command(addRoute)
.command(deleteRoute)
.command(listRoute)
.option('help', {
alias: 'h',
describe: t('common_help').d('Help'),
type: 'boolean',
default: false
})
.usage(`${t('common_usage').d('Usage')}: esa-cli route <add | list | delete>`);
},
handler: (argv) => {
if (yargsIns && (argv.help || argv._.length < 2)) {
yargsIns.showHelp('log');
}
}
};
export default routeCommand;