@@ -62,7 +62,133 @@ Once installed and authenticated, you can start using Gemini CLI by issuing
6262commands and prompts in your terminal. Ask it to generate code, explain files,
6363and more.
6464
65- To explore the power of Gemini CLI, see [ Gemini CLI examples] ( ./examples.md ) .
65+ <!-- prettier-ignore -->
66+ > [ !NOTE]
67+ > These examples demonstrate potential capabilities. Your actual
68+ > results can vary based on the model used and your project environment.
69+
70+ ### Rename your photographs based on content
71+
72+ You can use Gemini CLI to automate file management tasks that require visual
73+ analysis. In this example, Gemini CLI renames images based on their actual
74+ subject matter.
75+
76+ Scenario: You have a folder containing the following files:
77+
78+ ``` bash
79+ photos/photo1.png
80+ photos/photo2.png
81+ photos/photo3.png
82+ ```
83+
84+ Give Gemini the following prompt:
85+
86+ ``` cli
87+ Rename the photos in my "photos" directory based on their contents.
88+ ```
89+
90+ Result: Gemini asks for permission to rename your files.
91+
92+ Select ** Allow once** and your files are renamed:
93+
94+ ``` bash
95+ photos/yellow_flowers.png
96+ photos/antique_dresser.png
97+ photos/green_android_robot.png
98+ ```
99+
100+ ### Explain a repository by reading its code
101+
102+ Gemini CLI is effective for rapid codebase exploration. The following example
103+ shows how to ask Gemini CLI to fetch, analyze, and summarize a remote project.
104+
105+ Scenario: You want to understand how a popular open-source utility works by
106+ inspecting its code, not just its README.
107+
108+ Give Gemini CLI the following prompt:
109+
110+ ``` cli
111+ Clone the 'chalk' repository from https://github.com/chalk/chalk, read its key source files, and explain how it works.
112+ ```
113+
114+ Result: Gemini performs a sequence of actions to answer your request.
115+
116+ 1 . First, it asks for permission to run ` git clone ` to download the repository.
117+ 2 . Next, it finds the important source files and asks for permission to read
118+ them.
119+ 3 . Finally, after analyzing the code, it provides a summary.
120+
121+ Gemini CLI returns an explanation based on the actual source code:
122+
123+ ``` markdown
124+ The ` chalk ` library is a popular npm package for styling terminal output with
125+ colors. After analyzing the source code, here's how it works:
126+
127+ - ** Core functionality:** The main file sets up a chainable API. Each color or
128+ modifier (like ` bold ` or ` italic ` ) is a getter that appends the corresponding
129+ ANSI escape code to an internal stack.
130+
131+ - ** Chainable API:** When you call ` chalk.red.bold('Hello') ` , you are accessing
132+ getters. The ` red ` getter adds the red color code, and the ` bold ` getter adds
133+ the bold code.
134+
135+ - ** Output generation:** When the chain is treated as a string (e.g., in
136+ ` console.log ` ), a final ` toString() ` method is called. This method joins all
137+ the stored ANSI codes, wraps them around the input string ('Hello'), and adds
138+ a reset code at the end. This produces the final, styled string that the
139+ terminal can render.
140+ ```
141+
142+ ### Combine two spreadsheets into one spreadsheet
143+
144+ Gemini CLI can process and transform data across multiple files. Use this
145+ capability to merge reports or reformat data sets without manual copying.
146+
147+ Scenario: You have two .csv files: ` Revenue - 2023.csv ` and
148+ ` Revenue - 2024.csv ` . Each file contains monthly revenue figures.
149+
150+ Give Gemini CLI the following prompt:
151+
152+ ``` cli
153+ Combine the two .csv files into a single .csv file, with each year a different column.
154+ ```
155+
156+ Result: Gemini CLI reads each file and then asks for permission to write a new
157+ file. Provide your permission and Gemini CLI provides the combined data:
158+
159+ ``` csv
160+ Month,2023,2024
161+ January,0,1000
162+ February,0,1200
163+ March,0,2400
164+ April,900,500
165+ May,1000,800
166+ June,1000,900
167+ July,1200,1000
168+ August,1800,400
169+ September,2000,2000
170+ October,2400,3400
171+ November,3400,1800
172+ December,2100,9000
173+ ```
174+
175+ ### Run unit tests
176+
177+ Gemini CLI can generate boilerplate code and tests based on your existing
178+ implementation. This example demonstrates how to request code coverage for a
179+ JavaScript component.
180+
181+ Scenario: You've written a simple login page. You wish to write unit tests to
182+ ensure that your login page has code coverage.
183+
184+ Give Gemini CLI the following prompt:
185+
186+ ``` cli
187+ Write unit tests for Login.js.
188+ ```
189+
190+ Result: Gemini CLI asks for permission to write a new file and creates a test
191+ for your login page.
66192
67193## Check usage and quota
68194
0 commit comments