MCPcopy Create free account
hub / github.com/webpack/webpack-cli / #isCommand

Method #isCommand

packages/webpack-cli/src/webpack-cli.ts:2450–2468  ·  view source on GitHub ↗
(
    input: string,
    commandOptions: CommandOptions<A, O, C>,
  )

Source from the content-addressed store, hash-verified

2448 };
2449
2450 #isCommand<A = void, O extends CommanderArgs = CommanderArgs, C extends Context = Context>(
2451 input: string,
2452 commandOptions: CommandOptions<A, O, C>,
2453 ) {
2454 const longName = commandOptions.rawName;
2455
2456 if (input === longName) {
2457 return true;
2458 }
2459
2460 if (commandOptions.alias) {
2461 if (Array.isArray(commandOptions.alias)) {
2462 return commandOptions.alias.includes(input);
2463 }
2464 return commandOptions.alias === input;
2465 }
2466
2467 return false;
2468 }
2469
2470 #findCommandByName(name: string) {
2471 return this.program.commands.find(

Callers 2

#loadCommandByNameMethod · 0.95
runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected