diff options
| author | Harold Mciver <[email protected]> | 2025-07-16 11:56:05 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-16 15:56:05 +0000 |
| commit | ddcac4201d13bfa948c900f10f8c6cd227099c7b (patch) | |
| tree | d76faf860c45e5685cca281713407c210a7d0ec1 /packages/cli/src/ui/commands/docsCommand.ts | |
| parent | f4cd0055fd7fcb86bc7dddfd72aa8c6ed78a923e (diff) | |
update `/docs` to new slash command arch (#4133)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Diffstat (limited to 'packages/cli/src/ui/commands/docsCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/commands/docsCommand.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/packages/cli/src/ui/commands/docsCommand.ts b/packages/cli/src/ui/commands/docsCommand.ts new file mode 100644 index 00000000..e53a4a80 --- /dev/null +++ b/packages/cli/src/ui/commands/docsCommand.ts @@ -0,0 +1,37 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import open from 'open'; +import process from 'node:process'; +import { type CommandContext, type SlashCommand } from './types.js'; +import { MessageType } from '../types.js'; + +export const docsCommand: SlashCommand = { + name: 'docs', + description: 'open full Gemini CLI documentation in your browser', + action: async (context: CommandContext): Promise<void> => { + const docsUrl = 'https://goo.gle/gemini-cli-docs'; + + if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') { + context.ui.addItem( + { + type: MessageType.INFO, + text: `Please open the following URL in your browser to view the documentation:\n${docsUrl}`, + }, + Date.now(), + ); + } else { + context.ui.addItem( + { + type: MessageType.INFO, + text: `Opening documentation in your browser: ${docsUrl}`, + }, + Date.now(), + ); + await open(docsUrl); + } + }, +}; |
