Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit fd71035

Browse files
committed
fix: fixed command options
1 parent b163573 commit fd71035

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/command.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {convertToCached, ConvertToCachedOptions} from './cache'
88
import deps from './deps'
99
import * as flags from './flags'
1010

11-
export type CommandRunFn = <T extends Command>(this: ICommandClass<T>, argv?: string[], opts?: Config.IConfig | Config.ICommandOptions) => Promise<void>
11+
export type CommandRunFn = <T extends Command>(this: ICommandClass<T>, argv?: string[], opts?: Config.ICommandOptions) => Promise<void>
1212

1313
export interface ICommandClass<T extends Command> {
1414
run: CommandRunFn
@@ -38,11 +38,11 @@ export default abstract class Command {
3838
/**
3939
* instantiate and run the command
4040
*/
41-
static run: CommandRunFn = async function (argv: string[] = process.argv.slice(2), opts: Config.IConfig | Config.ICommandOptions = {}) {
41+
static run: CommandRunFn = async function (argv: string[] = process.argv.slice(2), opts: Config.ICommandOptions = {}) {
4242
let cmd!: Command
4343
try {
4444
let config
45-
if (Config.isIConfig(opts)) config = opts
45+
if (opts.config && Config.isIConfig(opts.config)) config = opts.config
4646
else config = await Config.read({root: opts.root || parentModule!})
4747
cmd = new this(argv, config)
4848
return await cmd.run()

0 commit comments

Comments
 (0)