Skip to content

Commit 4abc848

Browse files
committed
feat(runCommand): allow passing custom data
1 parent 3d7fff8 commit 4abc848

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/command.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function defineCommand<T extends ArgsDef = ArgsDef>(
1010

1111
export interface RunCommandOptions {
1212
rawArgs: string[];
13+
data?: any;
1314
showUsage?: boolean;
1415
}
1516

@@ -23,6 +24,7 @@ export async function runCommand<T extends ArgsDef = ArgsDef>(
2324
const context: CommandContext<T> = {
2425
rawArgs: opts.rawArgs,
2526
args: parsedArgs,
27+
data: opts.data,
2628
cmd,
2729
};
2830

‎src/types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export type CommandContext<T extends ArgsDef = ArgsDef> = {
6464
args: ParsedArgs<T>;
6565
cmd: CommandDef<T>;
6666
subCommand?: CommandDef<T>;
67+
data?: any;
6768
};
6869

6970
// ----- Utils -----

0 commit comments

Comments
 (0)