app/cli/commands/logout.ts
zzmq.dev@gmail.com/zz / app / cli / commands / logout.ts
@ 4fe782a0
Download
Ladder Summary
- file The file defines a **`logout`** function (exported) that calls `clearCredentials()` to delete the stored credentials file, then logs a message indicating either the username that was logged out or that no user was logged in. It serves as the implementation of the `zz logout` CLI command, providing a quick way to reset local authentication state.
// `zz logout`: the inverse of `zz login` -- drops the local
// credentials file so the next remote command (or `zz login` itself)
// starts fresh. Mainly for testing the not-logged-in experience and
// switching which account you're acting as, without hunting down
// ~/.zz/credentials.json by hand.
import { clearCredentials } from "../lib/credentials.js";
export function logout(): void {
const username = clearCredentials();
console.log(username ? `logged out of ${username}.` : "not logged in -- nothing to do.");
}