create-moost
Version:
35 lines (30 loc) • 921 B
text/typescript
import { CliApp, Controller, Cli, Param, CliExample, CliOption, Description } from '@moostjs/event-cli'
()
class Commands {
('Prints a greeting')
('hello world', 'Prints "Hello, world!"')
('hello world -u', 'Prints "HELLO, WORLD!"')
('hello/:name')
greet(
('A name to greet')
('name')
name: string,
('Whether to print the greeting in uppercase')
('uppercase', 'u')
uppercase: boolean,
) {
const output = `Hello, ${name}!`
return uppercase ? output.toUpperCase() : output
}
}
/**
* npm run dev hello world
*/
function run() {
new CliApp()
.controllers(Commands)
.useHelp({ name: '{{ packageName }}', title: ''})
.useOptions([{ keys: ['help'], description: 'Display instructions for the command.' }])
.start()
}
run()