integrations/commander/test/fixtures/nested-commands/command.ts
raw| 1 | import commander from "commander"; |
| 2 | import { addCompletionSpecCommand } from "../../../src"; |
| 3 | |
| 4 | const program = new commander.Command(); |
| 5 | |
| 6 | const brew = program.command("brew"); |
| 7 | brew.command("tea"); |
| 8 | brew.command("coffee"); |
| 9 | |
| 10 | function makeHeatCommand() { |
| 11 | const heat = new commander.Command("heat"); |
| 12 | heat.command("jug"); |
| 13 | heat.command("pot"); |
| 14 | return heat; |
| 15 | } |
| 16 | program.addCommand(makeHeatCommand()); |
| 17 | |
| 18 | addCompletionSpecCommand(program); |
| 19 | program.parse(process.argv); |