| 1 | /* eslint-disable class-methods-use-this */ |
| 2 | import { Command } from "commander"; |
| 3 | import { addCompletionSpecCommand } from "../../../src"; |
| 4 | |
| 5 | class CommandWithTrace extends Command { |
| 6 | createCommand(name: string) { |
| 7 | const cmd = new Command(name); |
| 8 | |
| 9 | cmd.option("-t, --trace", "display extra information when run command"); |
| 10 | return cmd; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | const program = new CommandWithTrace("program").option("-v, ---verbose"); |
| 15 | |
| 16 | program.command("serve [params...]").option("-p, --port <number>", "port number"); |
| 17 | |
| 18 | program.command("build <target>"); |
| 19 | |
| 20 | addCompletionSpecCommand(program); |
| 21 | program.parse(process.argv); |