(argv: string[])
| 86 | * @param argv The command-line arguments to parse |
| 87 | */ |
| 88 | export function parseCommandLine(argv: string[]): CompilerExplorerOptions { |
| 89 | const program = new Command(); |
| 90 | program |
| 91 | .name('compiler-explorer') |
| 92 | .description('Interactively investigate compiler output') |
| 93 | .option('--env <environments...>', 'Environment(s) to use', ['dev']) |
| 94 | .option('--root-dir <dir>', 'Root directory for config files', './etc') |
| 95 | .option('--host <hostname>', 'Hostname to listen on') |
| 96 | .option('--port <port>', 'Port to listen on', parsePortNumberForOptions, 10240) |
| 97 | .option('--prop-debug', 'Debug properties') |
| 98 | .option('--debug', 'Enable debug output') |
| 99 | .option('--dist', 'Running in dist mode') |
| 100 | .option('--no-remote-fetch', 'Ignore fetch marks and assume every compiler is found locally') |
| 101 | .option('--tmpDir, --tmp-dir <dir>', 'Directory to use for temporary files') |
| 102 | .option('--wsl', 'Running under Windows Subsystem for Linux') |
| 103 | .option('--language <languages...>', 'Only load specified languages for faster startup') |
| 104 | .option('--no-cache', 'Do not use caching for compilation results') |
| 105 | .option('--ensure-no-id-clash', "Don't run if compilers have clashing ids") |
| 106 | .option('--exit-on-compiler-failure', 'Exit with error code if any compilers fail to initialize') |
| 107 | .option('--logHost, --log-host <hostname>', 'Hostname for remote logging') |
| 108 | .option('--logPort, --log-port <port>', 'Port for remote logging', parsePortNumberForOptions) |
| 109 | .option('--hostnameForLogging, --hostname-for-logging <hostname>', 'Hostname to use in logs') |
| 110 | .option('--suppressConsoleLog, --suppress-console-log', 'Disable console logging') |
| 111 | .option('--metricsPort, --metrics-port <port>', 'Port to serve metrics on', parsePortNumberForOptions) |
| 112 | .option('--loki <url>', 'URL for Loki logging') |
| 113 | .option('--discoveryonly, --discovery-only <file>', 'Output discovery info to file and exit') |
| 114 | .option('--prediscovered <file>', 'Input discovery info from file') |
| 115 | .option('--static <dir>', 'Path to static content') |
| 116 | .option('--no-local', 'Disable local config') |
| 117 | .option('--version', 'Show version information') |
| 118 | .option( |
| 119 | '--dev-mode', |
| 120 | 'Run in dev mode (default if NODE_ENV is not production)', |
| 121 | process.env.NODE_ENV !== 'production', |
| 122 | ) |
| 123 | .option('--instance-color <color>', 'Instance color (blue or green) for deployment differentiation'); |
| 124 | |
| 125 | program.parse(argv); |
| 126 | return program.opts() as CompilerExplorerOptions; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Extract git release information from repository or file |
no test coverage detected