()
| 10 | } |
| 11 | |
| 12 | export async function loadSettings(): Promise<CliSettings> { |
| 13 | try { |
| 14 | const settingsPath = getSettingsPath() |
| 15 | const data = await fs.readFile(settingsPath, "utf-8") |
| 16 | return JSON.parse(data) as CliSettings |
| 17 | } catch (error) { |
| 18 | if ((error as NodeJS.ErrnoException).code === "ENOENT") { |
| 19 | return {} |
| 20 | } |
| 21 | |
| 22 | throw error |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | export async function saveSettings(settings: Partial<CliSettings>): Promise<void> { |
| 27 | const configDir = getConfigDir() |
no test coverage detected