(argv: string[])
| 220 | * @returns Application arguments |
| 221 | */ |
| 222 | export function parseArgsToAppArguments(argv: string[]): AppArguments { |
| 223 | const options = parseCommandLine(argv); |
| 224 | const isWsl = detectWsl(); |
| 225 | |
| 226 | const distPath = utils.resolvePathFromAppRoot('.'); |
| 227 | logger.debug(`Distpath=${distPath}`); |
| 228 | |
| 229 | const gitReleaseName = getGitReleaseName(distPath, options.dist === true); |
| 230 | const releaseBuildNumber = getReleaseBuildNumber(distPath, options.dist === true); |
| 231 | |
| 232 | const appArgs = convertOptionsToAppArguments(options, gitReleaseName, releaseBuildNumber, isWsl); |
| 233 | |
| 234 | if (options.version) { |
| 235 | // We can't use the `--version` support in Commander, as we need to parse the args |
| 236 | // to find the directory for the git release and whatnot. |
| 237 | logger.info('Compiler Explorer version info:'); |
| 238 | logger.info(` git release ${appArgs.gitReleaseName}`); |
| 239 | logger.info(` release build ${appArgs.releaseBuildNumber}`); |
| 240 | logger.info('Exiting'); |
| 241 | process.exit(0); |
| 242 | } |
| 243 | |
| 244 | return appArgs; |
| 245 | } |
no test coverage detected