Skip to content

Commit

Permalink
feat(runCommand): allow passing custom data
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 5, 2023
1 parent 3d7fff8 commit 4abc848
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function defineCommand<T extends ArgsDef = ArgsDef>(

export interface RunCommandOptions {
rawArgs: string[];
data?: any;
showUsage?: boolean;
}

Expand All @@ -23,6 +24,7 @@ export async function runCommand<T extends ArgsDef = ArgsDef>(
const context: CommandContext<T> = {
rawArgs: opts.rawArgs,
args: parsedArgs,
data: opts.data,
cmd,
};

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type CommandContext<T extends ArgsDef = ArgsDef> = {
args: ParsedArgs<T>;
cmd: CommandDef<T>;
subCommand?: CommandDef<T>;
data?: any;
};

// ----- Utils -----
Expand Down

0 comments on commit 4abc848

Please sign in to comment.