Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
program.version(packageJSON.version, '-v, --version');
// Make `-v` option case-insensitive.
process.argv = _.map(process.argv, arg => {
return (arg === '-V') ? '-v' : arg;
});
// `$ strapi version` (--version synonym)
program
.command('version')
.description('output your version of Strapi')
.action(() => { console.log(packageJSON.version); });
// `$ strapi console`
program
.command('console')
.description('open the Strapi framework console')
.action(require('./strapi-console'));
// `$ strapi new`
program
.command('new')
.option('-d, --dev', 'Development mode')
.option('--dbclient ', 'Database client')
.option('--dbhost ', 'Database host')
.option('--dbport ', 'Database port')
.option('--dbname ', 'Database name')
.option('--dbusername ', 'Database username')
.option('--dbpassword ', 'Database password')
.description('create a new application')
.action(require('./strapi-new'));
.action(require('./strapi-logout'));
// `$ strapi whoami`
program
.command('whoami')
.description('whoami to Strapi solutions')
.action(require('./strapi-whoami'));
// `$ strapi app:list`
program
.command('app:list')
.description('list your linked applications')
.action(require('./strapi-app'));
// `$ strapi app:link`
program
.command('app:link')
.description('link your applications')
.action(require('./strapi-app'));
/**
* Normalize help argument
*/
// `$ strapi help` (--help synonym)
program
.command('help')
.description('output the help')
.action(program.usageMinusWildcard);
// `$ strapi `
// Mask the '*' in `help`.
.action((id, attributes, cliArguments) => {
cliArguments.attributes = attributes;
require('./strapi-generate')(id, cliArguments);
});
// `$ strapi generate:controller`
program
.command('generate:controller ')
.option('-a, --api ', 'API name to generate a sub API')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a controller for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:model`
program
.command('generate:model [attributes...]')
.option('-a, --api ', 'API name to generate a sub API')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a model for an API')
.action((id, attributes, cliArguments) => {
cliArguments.attributes = attributes;
require('./strapi-generate')(id, cliArguments);
});
// `$ strapi generate:policy`
program
.command('generate:policy ')
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.description('generate a policy for an API')</template></template>
.action(require('./strapi-login'));
// `$ strapi logout`
program
.command('logout')
.description('logout from Strapi solutions')
.action(require('./strapi-logout'));
// `$ strapi whoami`
program
.command('whoami')
.description('whoami to Strapi solutions')
.action(require('./strapi-whoami'));
// `$ strapi app:list`
program
.command('app:list')
.description('list your linked applications')
.action(require('./strapi-app'));
// `$ strapi app:link`
program
.command('app:link')
.description('link your applications')
.action(require('./strapi-app'));
/**
* Normalize help argument
*/
// `$ strapi help` (--help synonym)
program
.description('link your applications')
.action(require('./strapi-app'));
/**
* Normalize help argument
*/
// `$ strapi help` (--help synonym)
program
.command('help')
.description('output the help')
.action(program.usageMinusWildcard);
// `$ strapi `
// Mask the '*' in `help`.
program
.command('*')
.action(program.usageMinusWildcard);
// Don't balk at unknown options.
/**
* `$ strapi`
*/
program.parse(process.argv);
const NO_COMMAND_SPECIFIED = program.args.length === 0;
if (NO_COMMAND_SPECIFIED) {
program.usageMinusWildcard();
}
.action(require('./strapi-uninstall'));
// `$ strapi login`
program
.command('login')
.description('login to Strapi solutions')
.action(require('./strapi-login'));
// `$ strapi logout`
program
.command('logout')
.description('logout from Strapi solutions')
.action(require('./strapi-logout'));
// `$ strapi whoami`
program
.command('whoami')
.description('whoami to Strapi solutions')
.action(require('./strapi-whoami'));
// `$ strapi app:list`
program
.command('app:list')
.description('list your linked applications')
.action(require('./strapi-app'));
// `$ strapi app:link`
program
.command('app:link')
.description('link your applications')
.action(require('./strapi-app'));
.action(require('./strapi-install'));
// `$ strapi uninstall`
program
.command('uninstall ')
.description('uninstall a Strapi plugin')
.action(require('./strapi-uninstall'));
// `$ strapi login`
program
.command('login')
.description('login to Strapi solutions')
.action(require('./strapi-login'));
// `$ strapi logout`
program
.command('logout')
.description('logout from Strapi solutions')
.action(require('./strapi-logout'));
// `$ strapi whoami`
program
.command('whoami')
.description('whoami to Strapi solutions')
.action(require('./strapi-whoami'));
// `$ strapi app:list`
program
.command('app:list')
.description('list your linked applications')
.action(require('./strapi-app'));
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.description('generate a policy for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:service`
program
.command('generate:service ')
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a service for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:plugin`
program
.command('generate:plugin ')
.option('-n, --name ', 'Plugin name')
.description('generate a basic plugin')
.action(require('./strapi-generate'));
// `$ strapi install`
program
.command('install ')
.option('-d, --dev', 'Development mode')
.description('install a Strapi plugin')
.action(require('./strapi-install'));
// `$ strapi uninstall`
program
.command('uninstall ')
.description('uninstall a Strapi plugin')</template>
.action((id, attributes, cliArguments) => {
cliArguments.attributes = attributes;
require('./strapi-generate')(id, cliArguments);
});
// `$ strapi generate:controller`
program
.command('generate:controller ')
.option('-a, --api ', 'API name to generate a sub API')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a controller for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:model`
program
.command('generate:model [attributes...]')
.option('-a, --api ', 'API name to generate a sub API')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a model for an API')
.action((id, attributes, cliArguments) => {
cliArguments.attributes = attributes;
require('./strapi-generate')(id, cliArguments);
});
// `$ strapi generate:policy`
program
.command('generate:policy ')
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.description('generate a policy for an API')</template></template>
.description('generate a model for an API')
.action((id, attributes, cliArguments) => {
cliArguments.attributes = attributes;
require('./strapi-generate')(id, cliArguments);
});
// `$ strapi generate:policy`
program
.command('generate:policy ')
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.description('generate a policy for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:service`
program
.command('generate:service ')
.option('-a, --api ', 'API name')
.option('-p, --plugin ', 'plugin name')
.option('-t, --tpl <template>', 'template name')
.description('generate a service for an API')
.action(require('./strapi-generate'));
// `$ strapi generate:plugin`
program
.command('generate:plugin ')
.option('-n, --name ', 'Plugin name')
.description('generate a basic plugin')
.action(require('./strapi-generate'));
// `$ strapi install`
program</template>