Skip to content

Commit dc8ae5a

Browse files
committed
fix: correct CLI syntax - use -p flag for non-interactive mode
- Add -p flag to all one-shot command examples - Document non-interactive mode limitations (no file writes, no shell) - Add --yolo mode documentation - Add --output-format json example - Update shell alias usage examples - Clarify Google Search works in interactive mode
1 parent 2e39d47 commit dc8ae5a

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,45 +29,42 @@ docker run -it --rm \
2929
ungb/gemini-cli
3030
```
3131

32-
### One-Shot Commands
32+
### One-Shot Commands (Non-Interactive)
33+
34+
Use the `-p` (or `--prompt`) flag for non-interactive mode:
3335

3436
```bash
3537
# Ask a question about your codebase
3638
docker run -it --rm \
3739
-v $(pwd):/workspace \
3840
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
3941
ungb/gemini-cli \
40-
gemini "explain the architecture of this project"
42+
gemini -p "explain the architecture of this project"
4143

4244
# Generate code
4345
docker run -it --rm \
4446
-v $(pwd):/workspace \
4547
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
4648
ungb/gemini-cli \
47-
gemini "create a REST API endpoint for user authentication"
48-
49-
# Fix bugs
50-
docker run -it --rm \
51-
-v $(pwd):/workspace \
52-
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
53-
ungb/gemini-cli \
54-
gemini "fix the failing tests in src/utils"
49+
gemini -p "create a REST API endpoint for user authentication"
5550

5651
# Code review
5752
docker run -it --rm \
5853
-v $(pwd):/workspace \
5954
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
6055
ungb/gemini-cli \
61-
gemini "review the changes in the last commit for security issues"
56+
gemini -p "review the changes in the last commit for security issues"
6257

63-
# Generate documentation
58+
# JSON output (for scripts/automation)
6459
docker run -it --rm \
6560
-v $(pwd):/workspace \
6661
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
6762
ungb/gemini-cli \
68-
gemini "generate API documentation for this module"
63+
gemini -p --output-format json "list all TODO comments"
6964
```
7065

66+
> **Note**: Non-interactive mode (`-p`) has limitations - it cannot authorize tools like WriteFile or run shell commands. For tasks requiring file modifications, use interactive mode.
67+
7168
### With Full Configuration (Recommended)
7269

7370
```bash
@@ -101,8 +98,19 @@ echo "GOOGLE_API_KEY=your-key-here" > .env
10198
# Interactive session
10299
docker compose run --rm gemini
103100

104-
# One-shot command
105-
docker compose run --rm gemini gemini "explain this code"
101+
# One-shot command (non-interactive, read-only)
102+
docker compose run --rm gemini gemini -p "explain this code"
103+
```
104+
105+
### YOLO Mode (Auto-Approve)
106+
107+
```bash
108+
# Auto-approve all tool calls (use with caution)
109+
docker run -it --rm \
110+
-v $(pwd):/workspace \
111+
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
112+
ungb/gemini-cli \
113+
gemini --yolo "refactor this code"
106114
```
107115

108116
### Sandbox Mode
@@ -113,19 +121,20 @@ docker run -it --rm \
113121
-v $(pwd):/workspace \
114122
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
115123
ungb/gemini-cli \
116-
gemini --sandbox "refactor this code"
124+
gemini --sandbox "analyze this code"
117125
```
118126

119127
### With Google Search Grounding
120128

121-
Gemini CLI has built-in Google Search for up-to-date information:
129+
Gemini CLI has built-in Google Search for up-to-date information (works in interactive mode):
122130

123131
```bash
124132
docker run -it --rm \
125133
-v $(pwd):/workspace \
126134
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
127-
ungb/gemini-cli \
128-
gemini "what are the latest best practices for React 19?"
135+
ungb/gemini-cli
136+
137+
# Then ask: "what are the latest best practices for React 19?"
129138
```
130139

131140
## Sharing Your Gemini Configuration
@@ -397,7 +406,8 @@ alias gemini-docker='docker run -it --rm \
397406
-e GOOGLE_API_KEY=$GOOGLE_API_KEY \
398407
ungb/gemini-cli gemini'
399408

400-
# Usage: gemini-docker "explain this code"
409+
# Usage (interactive): gemini-docker
410+
# Usage (one-shot): gemini-docker -p "explain this code"
401411
```
402412

403413
## License

0 commit comments

Comments
 (0)