MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / readCommandLineArgument

Function readCommandLineArgument

src/cli/parse.ts:186–205  ·  view source on GitHub ↗
(option: CommandLineOption, value: any)

Source from the content-addressed store, hash-verified

184}
185
186function 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
207enum OptionSource {
208 CommandLine,

Callers 1

updateParsedCommandLineFunction · 0.85

Calls 1

readValueFunction · 0.85

Tested by

no test coverage detected