import {Command, flags} from '@oclif/command' <%_ const klass = _.upperFirst(_.camelCase(name)) _%> <%_ if (type === 'single') { _%> class <%- klass %> extends Command { <%_ } else { _%> export default class <%- klass %> extends Command { <%_ } _%> static description = 'describe the command here' <%_ if (name === 'hello') { _%> static examples = [ `$ <%- cmd %> hello world from ./src/<%- name %>.ts! `, ] <%_ } _%> static flags = { <%_ if (type === 'single') { _%> // add --version flag to show CLI version version: flags.version({char: 'v'}), <%_ } _%> help: flags.help({char: 'h'}), // flag with a value (-n, --name=VALUE) name: flags.string({char: 'n', description: 'name to print'}), // flag with no value (-f, --force) force: flags.boolean({char: 'f'}), } static args = [{name: 'file'}] async run() { const {args, flags} = this.parse(<%- klass %>) const name = flags.name || 'world' this.log(`hello ${name} from <%- path.replace(/\\/g, '\\\\') %>`) if (args.file && flags.force) { this.log(`you input --force and --file: ${args.file}`) } } } <%_ if (type === 'single') { _%> export = <%- klass %> <%_ } _%>