| 90 | |
| 91 | /** Die Argumente, ohne Bibliothek. */ |
| 92 | export function parseArgs(argv) { |
| 93 | const options = { file: DEFAULT_TRACE_FILE, port: DEFAULT_BRIDGE_PORT, mode: 'live' }; |
| 94 | for (let i = 0; i < argv.length; i += 1) { |
| 95 | const arg = argv[i]; |
| 96 | if (arg === '--file' && argv[i + 1] !== undefined) { |
| 97 | options.file = argv[i + 1]; |
| 98 | i += 1; |
| 99 | } else if (arg === '--replay' && argv[i + 1] !== undefined) { |
| 100 | options.file = argv[i + 1]; |
| 101 | options.mode = 'replay'; |
| 102 | i += 1; |
| 103 | } else if (arg === '--port' && argv[i + 1] !== undefined) { |
| 104 | options.port = Number(argv[i + 1]); |
| 105 | i += 1; |
| 106 | } |
| 107 | } |
| 108 | options.file = isAbsolute(options.file) ? options.file : resolve(process.cwd(), options.file); |
| 109 | return options; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Die Wiederaufnahme-Angabe lesen. |