INNER CODE UNIT · TypeScript
updateConfig
exoframejs/exoframe · packages/exoframe-cli/src/config/index.ts:76
export async function updateConfig(newCfg: Partial<CliUserConfig>) {
const currentConfig = await getConfig();
const cfg = normalizeConfig(Object.assign(currentConfig, newCfg));
await writeFile(configPath, jsyaml.dump(cfg), 'utf8');
}
/**
* Checks whether the current config contains an authenticated user.
*
* @returns Whether the CLI currently has a logged-in user.
*/
export async function isLoggedIn() {
const userConfig = await getConfig();
if (!userConfig.user || !userConfig.user.username) {
console.log(chalk.red('Error: not logged in!'), 'Please, login first!');
return false;
}