The @rushstack/ts-command-line
library is used by many Node.js CLI tools developed by Microsoft, such as Heft, API Documenter and API Extractor.
Boilerplate
To use this boilerplate:
- Copy the code below.
- Rename
AppCommandLineParser
- Rename
AppCommandLineAction
- Fix things in
fixme
import {
CommandLineAction,
CommandLineParser,
} from '@rushstack/ts-command-line'
class AppCommandLineParser extends CommandLineParser {
public constructor() {
super({
toolFilename: 'fixme',
toolDescription: 'fixme',
})
this.addAction(new AppCommandLineAction())
}
protected onDefineParameters(): void {
// fixme
}
}
class AppCommandLineAction extends CommandLineAction {
public constructor() {
super({
actionName: 'fixme',
summary: 'fixme',
documentation: 'fixme',
})
}
protected onDefineParameters(): void {
// fixme
}
protected async onExecute(): Promise<void> {
// fixme
console.log('Hello!')
}
}
new AppCommandLineParser().execute()