diff --git a/src/classes/CommandOption.ts b/src/classes/CommandOption.ts index 4b41022..173b9bb 100644 --- a/src/classes/CommandOption.ts +++ b/src/classes/CommandOption.ts @@ -49,7 +49,11 @@ class CommandOption implements ICommandOption { this.name = def.name; this.aliases = def.aliases || []; - this.options = def.options || []; + this.options = []; + for (const opt of def.options || []) { + if (opt instanceof CommandOption) this.options.push(opt); + else this.options.push(new CommandOption(opt)); + } this.choices = def.choices || []; this.strict = def.strict || false; diff --git a/src/interfaces/CommandOption.ts b/src/interfaces/CommandOption.ts index cd40806..3c3561e 100644 --- a/src/interfaces/CommandOption.ts +++ b/src/interfaces/CommandOption.ts @@ -72,7 +72,7 @@ type CommandOptionDefinition = { name: string; aliases?: string[]; // eslint-disable-next-line no-use-before-define - options?: CommandOption[]; + options?: (CommandOption|CommandOptionDefinition)[]; type?: OptionType; strict?: boolean