()
| 52 | } |
| 53 | |
| 54 | getFullOptionsFromPrerequisiteChain(): BaseOption[] { |
| 55 | const self = this as unknown as BaseCommand; |
| 56 | const uniqueOptions = new Map(); |
| 57 | const visitedCommands = new Set(); |
| 58 | const queue: BaseCommand[] = [self]; |
| 59 | const excludedOptions = new Set( |
| 60 | self.getExcludedOptions().map(option => option.getOptionName()), |
| 61 | ); |
| 62 | while (queue.length > 0) { |
| 63 | const cur = queue.shift() as BaseCommand; |
| 64 | const options = cur.getOptions(); |
| 65 | for (const option of options) { |
| 66 | const optionName = option.getOptionName(); |
| 67 | if (excludedOptions.has(optionName)) { |
| 68 | continue; |
| 69 | } |
| 70 | if (!uniqueOptions.has(optionName)) { |
| 71 | uniqueOptions.set(optionName, option); |
| 72 | } |
| 73 | } |
| 74 | visitedCommands.add(cur.getCommandName()); |
| 75 | for (const prereq of cur.getPrerequisites()) { |
| 76 | if (!visitedCommands.has(prereq.getCommandName())) { |
| 77 | queue.push(prereq); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | return [...uniqueOptions.values()]; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | export default class BaseCommand extends Command { |
nothing calls this directly
no test coverage detected
searching dependent graphs…