From e765e1acdfe8e25c41b267eedd878c739d3e5261 Mon Sep 17 00:00:00 2001 From: Leo Goetz Date: Sun, 24 May 2026 13:37:55 +0200 Subject: fix: config and config command --- src/utils/config.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/utils/config.ts') diff --git a/src/utils/config.ts b/src/utils/config.ts index 62080f7..0706312 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -3,7 +3,7 @@ import fs from "fs/promises"; import type { Config } from "../types.js"; const configPath: string = new URL( - `${os.homedir()}/.config/dephelp/`, + `${os.homedir()}/.config/dephelp`, import.meta.url, ).pathname; @@ -34,15 +34,11 @@ export const getConfig = async (): Promise => { export const initConfig = async () => { try { - await fs.access(configPath); + await fs.access(configFile); + console.log(`You already have a config at: ${configFile}`); } catch { - await fs.mkdir(configPath); - } - - try { + await fs.mkdir(configPath, { recursive: true }); await fs.writeFile(`${configFile}`, JSON.stringify(sampleConfig, null, 2)); - console.log(`Config got generated in /.config/dephelp/config.json`); - } catch (error) { - console.error(error); + console.log(`Config got generated: ${configFile}`); } }; -- cgit v1.3.1