From 6a2ec8576159d7af6041f35d4fab96c876295da3 Mon Sep 17 00:00:00 2001 From: Florian Sihler Date: Mon, 6 Jan 2025 10:06:13 +0100 Subject: [PATCH] Throw an error if the requested config file does not exist/is not found (#1231) feat: throw error if requested config file not found --- src/cli/flowr.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cli/flowr.ts b/src/cli/flowr.ts index 49e607f4ba..f5afa4f53a 100644 --- a/src/cli/flowr.ts +++ b/src/cli/flowr.ts @@ -27,6 +27,7 @@ import { repl, replProcessAnswer } from './repl/core'; import { printVersionInformation } from './repl/commands/repl-version'; import { printVersionRepl } from './repl/print-version'; import { defaultConfigFile, flowrMainOptionDefinitions, getScriptsText } from './flowr-main-options'; +import fs from 'fs'; export const toolName = 'flowr'; @@ -87,6 +88,13 @@ if(options['config-json']) { } } if(!usedConfig) { + if(options['config-file']) { + // validate it exists + if(!fs.existsSync(options['config-file'])) { + log.error(`Config file '${options['config-file']}' does not exist`); + process.exit(1); + } + } setConfigFile(options['config-file'] ?? defaultConfigFile, undefined, true); }