diff --git a/src/file_functions/getTOMLFileValues.js b/src/file_functions/getTOMLFileValues.js index 303da32..f2a256a 100644 --- a/src/file_functions/getTOMLFileValues.js +++ b/src/file_functions/getTOMLFileValues.js @@ -11,15 +11,19 @@ const __homeDir = os.homedir(); export default function getTOMLFileValues() { const tomlFile = path.join(__homeDir, '.gimme_readme_config'); + if (!fs.existsSync(tomlFile)) { + return null; + } + try { const configContent = fs.readFileSync(tomlFile, 'utf-8'); const tomlParser = parseTOML(configContent); const config = getStaticTOMLValue(tomlParser); return config; - } catch (err) { + } catch (error) { console.error( - `Error at handleConfigOption when system is reading TOML at ${tomlFile} with error ${err}` + `Error parsing .gimme_readme_config. File is not formatted using TOML syntax: ${error}` ); - return null; + process.exit(1); } } diff --git a/src/option_handlers/handleConfigCase.js b/src/option_handlers/handleConfigCase.js deleted file mode 100644 index 9a07934..0000000 --- a/src/option_handlers/handleConfigCase.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function normConfigCase(config) { - return Object.keys(config).reduce((previousValue, key) => { - previousValue[key.toLowerCase()] = config[key]; - return previousValue; - }, {}); -}