You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
811 B
31 lines
811 B
import { Command, flags } from '@oclif/command';
|
|
|
|
export default class Index extends Command {
|
|
static description = 'describe the command here';
|
|
|
|
static examples = [
|
|
`$ nbx hello
|
|
hello world from ./src/hello.ts!
|
|
`,
|
|
];
|
|
|
|
static flags = {
|
|
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(Index);
|
|
|
|
const name = flags.name || 'world';
|
|
this.log(`hello ${name} (${args.file}) from ./src/commands/hello.ts`);
|
|
if (args.file && flags.force) {
|
|
this.log(`you input --force and --file: ${args.file}`);
|
|
}
|
|
}
|
|
}
|