MCPcopy Create free account
hub / github.com/FastLED/FastLED / parseArgs

Function parseArgs

ci/docker_utils/avr8js/main.ts:12–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10}
11
12function parseArgs(): RunOptions {
13 const args = process.argv.slice(2);
14
15 if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
16 console.log(`
17AVR8JS Test Runner - Execute AVR hex files in simulation
18
19Usage: npm start <hex-file> [options]
20
21Arguments:
22 hex-file Path to Intel HEX file to execute
23
24Options:
25 --timeout <seconds> Maximum simulated time in seconds (default: 30)
26 --verbose Enable verbose output
27 -h, --help Show this help message
28
29Example:
30 npm start build/output.hex --timeout 5
31`);
32 exit(args.includes("--help") || args.includes("-h") ? 0 : 1);
33 }
34
35 const options: RunOptions = {
36 hexFile: args[0],
37 timeout: 30,
38 verbose: false
39 };
40
41 for (let i = 1; i < args.length; i++) {
42 if (args[i] === "--timeout" && i + 1 < args.length) {
43 options.timeout = parseFloat(args[++i]);
44 } else if (args[i] === "--verbose") {
45 options.verbose = true;
46 }
47 }
48
49 return options;
50}
51
52async function executeProgram(hex: string, options: RunOptions): Promise<number> {
53 const runner = new AVRRunner(hex);

Callers 1

mainFunction · 0.85

Calls 4

exitFunction · 0.85
parseFloatFunction · 0.85
sliceMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected