dalao-proxy
Version:
An expandable HTTP proxy based on the plug-in system for frontend developers with request caching request mock and development!
38 lines (36 loc) • 1.51 kB
JavaScript
const { displayPluginTable } = require('./list-plugin');
module.exports = function pluginListCommand(pluginCommand, register) {
pluginCommand
.command('list')
.description('list all installed plugins')
.option('-g, --global', 'show plugins globally installed only')
.option('-a, --all', 'show all table fields')
.option('-c, --child', 'show child plugins')
.option('--desc', 'show description')
.option('--midware', 'show middleware field')
.option('--cmd', 'show command field')
.option('--conf', 'show configure field')
.action(function () {
register.on('context:config', () => {
const plugins = this.context.plugins;
const {
global: isGlobal,
all: showAll,
child: showChild,
desc: showDescription,
midware: showMiddleware,
cmd: showCommand,
conf: showConfigure
} = this.context.options;
displayPluginTable(plugins, {
isGlobal,
isAll: showAll,
showChild,
showDescription: showDescription || showAll,
showMiddleware: showMiddleware || showAll,
showCommand: showCommand || showAll,
showConfigure: showConfigure || showAll,
});
});
});
};