Skip to content

Commit

Permalink
feat(command): add .getParent() and .getMainCommand() method's
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Jun 14, 2020
1 parent 53a9af7 commit 1a900be
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/command/lib/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,26 @@ export class BaseCommand<O = any, A extends Array<any> = any> {
********************************************************************************/

/**
* Get or set command name.
* Get command name.
*/
public getName(): string {
return this._name;
}

/**
* Get parent command name.
*/
public getParent(): BaseCommand | undefined {
return this._parent;
}

/**
* Get main command.
*/
public getMainCommand(): BaseCommand {
return this._parent?.getMainCommand() ?? this;
}

/**
* Get command name aliases.
*/
Expand Down

0 comments on commit 1a900be

Please sign in to comment.