mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 00:21:09 -07:00
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
|
|
/**
|
||
|
|
* @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);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
};
|