mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-02 17:31:05 -07:00
feat(cli): Add /auth logout command to clear credentials and auth state (#13383)
This commit is contained in:
@@ -4,7 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { useCallback, useMemo, useEffect, useState } from 'react';
|
||||
import {
|
||||
useCallback,
|
||||
useMemo,
|
||||
useEffect,
|
||||
useState,
|
||||
createElement,
|
||||
} from 'react';
|
||||
import { type PartListUnion } from '@google/genai';
|
||||
import process from 'node:process';
|
||||
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
@@ -45,6 +51,11 @@ import {
|
||||
} from '../state/extensions.js';
|
||||
import { appEvents } from '../../utils/events.js';
|
||||
import { useAlternateBuffer } from './useAlternateBuffer.js';
|
||||
import {
|
||||
LogoutConfirmationDialog,
|
||||
LogoutChoice,
|
||||
} from '../components/LogoutConfirmationDialog.js';
|
||||
import { runExitCleanup } from '../../utils/cleanup.js';
|
||||
|
||||
interface SlashCommandProcessorActions {
|
||||
openAuthDialog: () => void;
|
||||
@@ -400,6 +411,22 @@ export const useSlashCommandProcessor = (
|
||||
Date.now(),
|
||||
);
|
||||
return { type: 'handled' };
|
||||
case 'logout':
|
||||
// Show logout confirmation dialog with Login/Exit options
|
||||
setCustomDialog(
|
||||
createElement(LogoutConfirmationDialog, {
|
||||
onSelect: async (choice: LogoutChoice) => {
|
||||
setCustomDialog(null);
|
||||
if (choice === LogoutChoice.LOGIN) {
|
||||
actions.openAuthDialog();
|
||||
} else {
|
||||
await runExitCleanup();
|
||||
process.exit(0);
|
||||
}
|
||||
},
|
||||
}),
|
||||
);
|
||||
return { type: 'handled' };
|
||||
case 'dialog':
|
||||
switch (result.dialog) {
|
||||
case 'auth':
|
||||
|
||||
Reference in New Issue
Block a user