Skip to content

Commit

Permalink
refactor(cli): add the config path
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Oct 27, 2023
1 parent 6c89e39 commit 427af02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli/src/Command/CommandAbstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export abstract class CommandAbstract<
readonly globalOptions: GlobalOptions<true>,
options: TUnresolvedOptions,
streams: Partial<Streams> = {},
readonly configPath?: string,
) {
this.options = parseOptions(options, this.onOptions());
this.streams = createStreams(streams);
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/Factory/CommandFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ export function CommandFactory<TCommand extends keyof OptionsMapType>(
globalOptions: GlobalOptions<true>,
options: OptionsMapType[TCommand],
streams?: Partial<Streams>,
configPath?: string,
) {
const constructor = CommandConstructorFactory(type);
return new constructor(globalOptions, options as any, streams);
return new constructor(globalOptions, options as any, streams, configPath);
}

export async function exec<TCommand extends keyof OptionsMapType>(
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ function makeCommandAction<T>(command: CommandEnum) {
config: config.data,
},
options as any,
{},
globalOptions.config,
).onExec();
} catch (e) {
const error = e as Error;
Expand Down

0 comments on commit 427af02

Please sign in to comment.