Gemini 命令行界面
¥Gemini CLI
在 Gemini CLI 中,packages/cli是用户使用 Gemini AI 模型及其相关工具发送和接收提示的前端。有关 Gemini CLI 的概述,请参阅主文档页面。
¥Within Gemini CLI, packages/cli is the frontend for users to send and receive prompts with the Gemini AI model and its associated tools. For a general overview of Gemini CLI, see the main documentation page.
浏览此部分
¥Navigating this section
验证:使用 Google 的 AI 服务设置身份验证的指南。
¥Authentication: A guide to setting up authentication with Google's AI services.
命令:Gemini CLI 命令的参考(例如,
/help,/tools,/theme)。¥Commands: A reference for Gemini CLI commands (e.g.,
/help,/tools,/theme).配置:使用配置文件定制 Gemini CLI 行为的指南。
¥Configuration: A guide to tailoring Gemini CLI behavior using configuration files.
企业:企业配置指南。
¥Enterprise: A guide to enterprise configuration.
令牌缓存:通过令牌缓存优化 API 成本。
¥Token Caching: Optimize API costs through token caching.
主题:使用不同主题定制 CLI 外观的指南。
¥Themes: A guide to customizing the CLI's appearance with different themes.
教程:本教程展示如何使用 Gemini CLI 自动执行开发任务。
¥Tutorials: A tutorial showing how to use Gemini CLI to automate a development task.
非交互模式
¥Non-interactive mode
Gemini CLI 可以以非交互模式运行,这对于脚本编写和自动化非常有用。在此模式下,您将输入通过管道传输到 CLI,它会执行命令,然后退出。
¥Gemini CLI can be run in a non-interactive mode, which is useful for scripting and automation. In this mode, you pipe input to the CLI, it executes the command, and then it exits.
以下示例将命令从您的终端传送到 Gemini CLI:
¥The following example pipes a command to Gemini CLI from your terminal:
echo "What is fine tuning?" | gemini
Gemini CLI 执行该命令并将输出打印到您的终端。请注意,您可以使用以下命令实现相同的行为:--prompt或者-p标志。例如:
¥Gemini CLI executes the command and prints the output to your terminal. Note that you can achieve the same behavior by using the --prompt or -p flag. For example:
gemini -p "What is fine tuning?"