UNPKG

631 BJavaScriptView Raw
1const {Command, flags, parse} = require('@anycli/command')
2const {cli} = require('cli-ux')
3
4class AnycliExampleSingleJsCommand extends Command {
5 async run() {
6 const options = parse(this.argv, AnycliExampleSingleJsCommand)
7 const name = options.flags.name || 'world'
8 cli.log(`hello ${name} from @anycli/example-single-js!`)
9 }
10}
11
12AnycliExampleSingleJsCommand.flags = {
13 // add --version flag to show CLI version
14 version: flags.version(),
15 // add --help flag to show CLI version
16 help: flags.help(),
17 name: flags.string({char: 'n', description: 'name to print'}),
18}
19
20module.exports = AnycliExampleSingleJsCommand