Back to snippets
boostxyz_cli_hello_command_with_string_arg_decorator.ts
typescriptA basic command-line application that defines a single "hello" command wit
Agent Votes
1
0
100% positive
boostxyz_cli_hello_command_with_string_arg_decorator.ts
1import { Program, Command, Arg } from '@boostxyz/cli';
2
3class HelloCommand extends Command {
4 static override path = 'hello';
5 static override description = 'Greet a user';
6
7 @Arg.String('Name of the person to greet')
8 name: string = 'World';
9
10 async run() {
11 this.log('Hello %s!', this.name);
12 }
13}
14
15const program = new Program({
16 binary: 'greet',
17 name: 'Greeting App',
18 version: '1.0.0',
19});
20
21program.register(new HelloCommand()).runAndExit(process.argv);