mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
.action --> doAction
This commit is contained in:
parent
f452e8324f
commit
f87e76d624
1 changed files with 5 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import { parseSubcommand } from './parsing.ts';
|
|||
export class Command {
|
||||
name: string;
|
||||
description: string;
|
||||
action: (args: ParsedArgs) => void | Promise<void> = (_) => {};
|
||||
private action: (args: ParsedArgs) => void | Promise<void> = (_) => {};
|
||||
options: Record<string, Option> = {};
|
||||
commands: Record<string, Command> = {};
|
||||
|
||||
|
|
@ -38,6 +38,10 @@ export class Command {
|
|||
return this;
|
||||
}
|
||||
|
||||
async doAction(args: ParsedArgs) {
|
||||
return await this.action(args);
|
||||
}
|
||||
|
||||
subcommand(command: Command) {
|
||||
if (this.isValidSubcommand(command.name)) {
|
||||
throw new Error(`tribes-cli: ${command.name} is already a subcommand.`);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue