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