mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
fix: Exit app on pressing esc on trust dialog at launch (#10668)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Box, Text } from 'ink';
|
||||
import type React from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import type { RadioSelectItem } from './shared/RadioButtonSelect.js';
|
||||
import { RadioButtonSelect } from './shared/RadioButtonSelect.js';
|
||||
@@ -30,6 +30,7 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
|
||||
onSelect,
|
||||
isRestarting,
|
||||
}) => {
|
||||
const [exiting, setExiting] = useState(false);
|
||||
useEffect(() => {
|
||||
const doRelaunch = async () => {
|
||||
if (isRestarting) {
|
||||
@@ -44,7 +45,10 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
|
||||
useKeypress(
|
||||
(key) => {
|
||||
if (key.name === 'escape') {
|
||||
onSelect(FolderTrustChoice.DO_NOT_TRUST);
|
||||
setExiting(true);
|
||||
setTimeout(() => {
|
||||
process.exit(1);
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
{ isActive: !isRestarting },
|
||||
@@ -65,9 +69,9 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
|
||||
key: `Trust parent folder (${parentFolder})`,
|
||||
},
|
||||
{
|
||||
label: "Don't trust (esc)",
|
||||
label: "Don't trust",
|
||||
value: FolderTrustChoice.DO_NOT_TRUST,
|
||||
key: "Don't trust (esc)",
|
||||
key: "Don't trust",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -105,6 +109,14 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
{exiting && (
|
||||
<Box marginLeft={1} marginTop={1}>
|
||||
<Text color={theme.status.warning}>
|
||||
A folder trust level must be selected to continue. Exiting since
|
||||
escape was pressed.
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user