Thanks to visit codestin.com
Credit goes to google-gemini.github.io

gemini-cli

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.

Non-interactive mode

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.

The following example pipes a command to Gemini CLI from your terminal:

echo "What is fine tuning?" | gemini

You can also use the --prompt or -p flag:

gemini -p "What is fine tuning?"

For comprehensive documentation on headless usage, scripting, automation, and advanced examples, see the Headless Mode guide.