From 88236f24bdd3718511885e02636f4a87c52819d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Thu, 22 Feb 2024 15:33:12 +0100 Subject: [PATCH] CommanderCommand => Add possibility to have aliases and command options --- NodeApp/src/commander/CommanderCommand.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NodeApp/src/commander/CommanderCommand.ts b/NodeApp/src/commander/CommanderCommand.ts index b5fd5e7..2586069 100644 --- a/NodeApp/src/commander/CommanderCommand.ts +++ b/NodeApp/src/commander/CommanderCommand.ts @@ -1,12 +1,16 @@ -import { Command } from 'commander'; +import { Command, CommandOptions } from 'commander'; abstract class CommanderCommand { protected abstract commandName: string; + protected aliasNames: Array<string> = []; + + protected options: CommandOptions = {}; + command: Command = new Command(); registerOnCommand(parent: Command) { - this.command = parent.command(this.commandName); + this.command = parent.command(this.commandName, this.options).aliases(this.aliasNames); this.defineCommand(); this.defineSubCommands(); -- GitLab