import { captureEvent } from "../common/analytics/lib.js";
import { printResultToConsoleAndExitGracefully } from "../common/output.js";
import { logout } from "../login/logout.js";
export default {
    desc: "Logs the current user out if logged in",
    command: "logout",
    builder: (yargs) => {
        return yargs
            .usage("$0 logout")
            .example([["$0 logout", "Remove locally stored Zuplo credentials"]]);
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo logout" });
        const result = await logout();
        if (!result.hadCredentials) {
            await printResultToConsoleAndExitGracefully("You are not currently logged in.");
            return;
        }
        await printResultToConsoleAndExitGracefully("Successfully logged out.");
    },
};
//# sourceMappingURL=logout.js.map