export default function({ definitions, help, usage, start }) { program.loadDefinitions(definitions); if (usage) { program.usage(usage); } if (help) { program.on('--help', help); } program.parse(process.argv, process.env); const options = program.getOptions(); start(program, options, function() { logStartupOptions(options); }); }
program .version(packageJson.version) .arguments('<project-directory>') .usage(`${chalk.green('<project-directory>')}`) .action(name => { projectName = name; }) .on('--help', () => { console.log(); console.log(`Only ${chalk.green('<project-directory>')} is required.`); });
program .command('template <type>') .usage('<type> --filename [filename] --path [path]') .description('템플릿을 생성합니다.') .alias('tmpl') .option('-f, --filename [filename]', '파일명을 입력하세요.', 'index') .option('-d, --directory [path]', '생성 경로를 입력하세요', '.') .action((type, options) => { makeTemplate(type, options.filename, options.directory); });
new commander.Command(packageJson.name) .version(packageJson.version) .arguments('<project-directory>') .usage(`${chalk.green('<project-directory>')} [options]`) .action(name => (projectName = name)) .option('--verbose', 'print additional logs') .allowUnknownOption() .on('--help', () => { console.log(` Only ${chalk.green('<project-directory>')} is required.\n`) }) .parse(process.argv)
// rm - delete a saved boilerplate cli .command('rm <names...>') .usage(`${chalk.yellow('<names...>')}`) .description('delete a saved boilerplate') .on('--help', () => { console.log(`\n${chalk.yellow('<names...>')} can be one or more names of saved boilerplates.`); console.log(`You can check out what you've saved with ${chalk.yellow('snap ls')}.\n`); }) .action(rm);
// tslint:disable-next-line no-require-imports no-var-requires // const { version } = require('../package.json'); program .version('1.7.0') .usage('[options] <schema.json | schema.gql> <query.gql>') .option('-o --output-file [outputFile]', 'name for output file, will use stdout if not specified') .option('-n --namespace [namespace]', 'name for the namespace, defaults to "GQL"', 'GQL') .option('-i --ignored-types <ignoredTypes>', 'names of types to ignore (comma delimited)', v => v.split(','), []) .option('-l --legacy', 'Use TypeScript 1.x annotation', false) .option('-e --external-options [externalOptions]', 'ES Module with method overwrites') .option('--ignore-type-name-declaration', 'Whether to exclude __typename', false) .option('--exclude-deprecated-fields', 'Whether to exclude deprecated fields', false) .parse(process.argv);
program .description(chalk.white('Clay allows you to instantly build and remix cloud hosted functions')) .version('0.5.2') .usage('<command>') .command('new [serviceName]') .description('creates a new service with the name [serviceName].') .action((cmd) => service.create(cmd, account))
// cli info cli .version(pkg.version, '-v, --version') .usage(`${chalk.yellow('<command>')} ${chalk.gray('or')} snap ${chalk.yellow('<boilerplate-name> <project-directory> [options]')}`) .on('--help', () => { console.log('\nFor example, to save a React starter project from GitHub for future use...'); console.log(` snap save react https://github.com/user/react-starter.git`); console.log(` snap react my-project`); console.log(' cd my-project\n'); console.log('If you encounter any problems, please open an issue:'); console.log(` ${chalk.cyan('https://github.com/jolaleye/snap/issues')}\n`); });
program .version(version) .usage('task [options]') .arguments('<task>') .option('-s, --stages <stages>', 'Specify stages you want to run', function(value) { return value.split(','); }) .action(function (task) { taskName = task; }) .parse(process.argv);
// save - save a directory or repository to a name cli .command('save <name> [source]') .usage(chalk.yellow('<name> [source] [options]')) .description('save a directory or respository') .option('-o, --overwrite', 'overwrite an existing boilerplate with the same name') .on('--help', () => { console.log(`\n${chalk.yellow('[source]')} can be...`); console.log(` - a local path to a directory: ${chalk.cyan('./starter')}`); console.log(` - a Git repository URL: ${chalk.cyan('https://github.com/user/starter.git')}`); console.log('If no source is provided, it will default to the current directory.\n'); }) .action(save);
program .name('oas-generator') .usage('<OAS v3 file in YAML or JSON>') .arguments('<file>') .option('-n, --projectName <projectName>', 'Name for the generated folder') .option('-z, --generateZip', 'Generate a zip and delete the folder') .option('-j, --json', 'Generate oas-doc file as JSON (default is YAML)') .action(function(file, cmd) { generate.generateServer(file, cmd); }) .parse(process.argv);
program .version(pckg.version) .usage('[options]') // HACK: Commander only registers `-V` .option('-v, --version', 'output the version number') .on('option:version', () => { return console.log(program._version) }) .action(() => { program.help() })
program .version(thancPkg.version) .usage('[options] <project_path>') .option('--me', 'thank thanc package and all of its dependencies') .option('-u, --username <username>', 'your Github username') .option('-p, --password <password>', 'your Github password') .option('-t, --token <password>', 'your Github token') .option('-q, --quite', 'Show only the progress bar instead of the repos list') .arguments('<path>') .action(path => projectPath = path ? path : projectPath) .parse(process.argv)
option .version('0.1.0') .usage('[options] <file ...>') .option('-p, --port <n>', 'Set Port Number',(val)=>{return val}, 5000) .option('-h, --host <s>', 'Set Host Address',(val)=>{return val}, 'localhost') .option('-t, --test', 'Testing build') .parse(process.argv);
program .version(packageJson.version) .arguments('<project-directory>') .usage(`${chalk.green('<project-directory>')}`) .action(name => { projectName = name; }) .on('--help', () => { console.log(); console.log(`Only ${chalk.green('<project-directory>')} is required.`); });