Skip to content

Commit

Permalink
chore: remove duplicated rootCommand logic
Browse files Browse the repository at this point in the history
  • Loading branch information
carloscortonc committed Sep 6, 2023
1 parent 485b878 commit de0dce4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions src/cli-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ export async function executeScript({ location, options }: Omit<ParsingOutput, "
const finalLocation = [
// Apply CliOptions.commandsPath configuration for single commands
...(location.length === 1 && cliOptions.commandsPath !== "." ? [cliOptions.commandsPath] : []),
// Include CliOptions.rootCommand if empty location provided
...(location.length === 0 && typeof cliOptions.rootCommand === "string" ? [cliOptions.rootCommand] : []),
].concat(location);

const scriptPaths = [".", ...finalLocation]
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default class Cli {
run(args?: string[]): void | Promise<void> {
const args_ = Array.isArray(args) ? args : process.argv.slice(2);
const opts = this.parse(args_);
// Include CliOptions.rootCommand if empty location provided
const elementLocation =
opts.location.length === 0 && typeof this.options.rootCommand === "string"
? [this.options.rootCommand]
Expand Down

0 comments on commit de0dce4

Please sign in to comment.