( cliArguments: string[], usedCliArguments: boolean[], task: Task, )
| 211 | } |
| 212 | |
| 213 | export function parseTaskArguments( |
| 214 | cliArguments: string[], |
| 215 | usedCliArguments: boolean[], |
| 216 | task: Task, |
| 217 | ): TaskArguments { |
| 218 | const taskArguments: TaskArguments = {}; |
| 219 | |
| 220 | // Parse options |
| 221 | parseOptions(cliArguments, usedCliArguments, task.options, taskArguments); |
| 222 | |
| 223 | parsePositionalAndVariadicArguments( |
| 224 | cliArguments, |
| 225 | usedCliArguments, |
| 226 | task, |
| 227 | taskArguments, |
| 228 | ); |
| 229 | |
| 230 | const unusedIndex = usedCliArguments.indexOf(false); |
| 231 | |
| 232 | if (unusedIndex !== -1) { |
| 233 | throw new HardhatError(HardhatError.ERRORS.CORE.ARGUMENTS.UNUSED_ARGUMENT, { |
| 234 | value: cliArguments[unusedIndex], |
| 235 | }); |
| 236 | } |
| 237 | |
| 238 | return taskArguments; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Parses the raw arguments from the command line, returning an array of |
no test coverage detected