mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
Add hidden property to slash commands (#7797)
This commit is contained in:
@@ -220,6 +220,18 @@ describe('useSlashCommandProcessor', () => {
|
||||
expect(fileAction).toHaveBeenCalledTimes(1);
|
||||
expect(builtinAction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not include hidden commands in the command list', async () => {
|
||||
const visibleCommand = createTestCommand({ name: 'visible' });
|
||||
const hiddenCommand = createTestCommand({ name: 'hidden', hidden: true });
|
||||
const result = setupProcessorHook([visibleCommand, hiddenCommand]);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(result.current.slashCommands).toHaveLength(1);
|
||||
});
|
||||
|
||||
expect(result.current.slashCommands[0].name).toBe('visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Command Execution Logic', () => {
|
||||
|
||||
@@ -443,6 +443,7 @@ export function useSlashCompletion(props: UseSlashCompletionProps): {
|
||||
commands.filter(
|
||||
(cmd) =>
|
||||
cmd.description &&
|
||||
!cmd.hidden &&
|
||||
(cmd.name.toLowerCase().startsWith(partial.toLowerCase()) ||
|
||||
cmd.altNames?.some((alt) =>
|
||||
alt.toLowerCase().startsWith(partial.toLowerCase()),
|
||||
|
||||
Reference in New Issue
Block a user