import fs from "fs"; import yaml from "yaml"; import { Config } from "../types/config"; export function loadConfig(file: string): Config { const text = fs.readFileSync(file, 'utf-8'); const cfg = yaml.parse(text) as Config; for (const profile of Object.keys(cfg.profiles)) { if (cfg.profiles[profile]) { cfg.profiles[profile].name = profile; } } return cfg; }