(option: CommandLineOption, value: any)
| 184 | } |
| 185 | |
| 186 | function readCommandLineArgument(option: CommandLineOption, value: any): CommandLineArgument { |
| 187 | if (option.type === "boolean") { |
| 188 | if (value === "true" || value === "false") { |
| 189 | value = value === "true"; |
| 190 | } else { |
| 191 | // Set boolean arguments without supplied value to true |
| 192 | return { value: true, consumed: false }; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | if (value === undefined) { |
| 197 | return { |
| 198 | error: cliDiagnostics.compilerOptionExpectsAnArgument(option.name), |
| 199 | value: undefined, |
| 200 | consumed: false, |
| 201 | }; |
| 202 | } |
| 203 | |
| 204 | return { ...readValue(option, value, OptionSource.CommandLine), consumed: true }; |
| 205 | } |
| 206 | |
| 207 | enum OptionSource { |
| 208 | CommandLine, |
no test coverage detected