mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 02:00:40 -07:00
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type { CommandContext } from '../commands/types.js';
|
|
import type { ExtensionUpdateAction } from '../state/extensions.js';
|
|
|
|
/**
|
|
* Creates a UI context object with no-op functions.
|
|
* Useful for non-interactive environments where UI operations
|
|
* are not applicable.
|
|
*/
|
|
export function createNonInteractiveUI(): CommandContext['ui'] {
|
|
return {
|
|
addItem: (item, _timestamp) => {
|
|
if ('text' in item && item.text) {
|
|
if (item.type === 'error') {
|
|
process.stderr.write(`Error: ${item.text}\n`);
|
|
} else if (item.type === 'warning') {
|
|
process.stderr.write(`Warning: ${item.text}\n`);
|
|
} else if (item.type === 'info') {
|
|
process.stdout.write(`${item.text}\n`);
|
|
}
|
|
}
|
|
return 0;
|
|
},
|
|
clear: () => {},
|
|
setDebugMessage: (_message) => {},
|
|
loadHistory: (_newHistory) => {},
|
|
pendingItem: null,
|
|
setPendingItem: (_item) => {},
|
|
toggleCorgiMode: () => {},
|
|
toggleDebugProfiler: () => {},
|
|
toggleVimEnabled: async () => false,
|
|
reloadCommands: () => {},
|
|
openAgentConfigDialog: () => {},
|
|
extensionsUpdateState: new Map(),
|
|
dispatchExtensionStateUpdate: (_action: ExtensionUpdateAction) => {},
|
|
addConfirmUpdateExtensionRequest: (_request) => {},
|
|
setConfirmationRequest: (_request) => {},
|
|
removeComponent: () => {},
|
|
toggleBackgroundTasks: () => {},
|
|
toggleShortcutsHelp: () => {},
|
|
};
|
|
}
|