From 4abc8487ca656ac60be1167e4a5322782212ae04 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 6 Jul 2023 01:26:32 +0200 Subject: [PATCH] feat(runCommand): allow passing custom `data` --- src/command.ts | 2 ++ src/types.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/command.ts b/src/command.ts index 0c358f4..9c87b3c 100644 --- a/src/command.ts +++ b/src/command.ts @@ -10,6 +10,7 @@ export function defineCommand( export interface RunCommandOptions { rawArgs: string[]; + data?: any; showUsage?: boolean; } @@ -23,6 +24,7 @@ export async function runCommand( const context: CommandContext = { rawArgs: opts.rawArgs, args: parsedArgs, + data: opts.data, cmd, }; diff --git a/src/types.ts b/src/types.ts index 13df918..85857bb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -64,6 +64,7 @@ export type CommandContext = { args: ParsedArgs; cmd: CommandDef; subCommand?: CommandDef; + data?: any; }; // ----- Utils -----