mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 04:24:51 -07:00
cleanup(markdown): Prettier format all markdown @ 80 char width (#10714)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
# Gemini CLI Examples
|
||||
|
||||
Not sure where to get started with Gemini CLI? This document covers examples on how to use Gemini CLI for a variety of tasks.
|
||||
Not sure where to get started with Gemini CLI? This document covers examples on
|
||||
how to use Gemini CLI for a variety of tasks.
|
||||
|
||||
**Note:** Results are examples intended to showcase potential use cases. Your results may vary.
|
||||
**Note:** Results are examples intended to showcase potential use cases. Your
|
||||
results may vary.
|
||||
|
||||
## Rename your photographs based on content
|
||||
|
||||
@@ -32,7 +34,8 @@ photos/green_android_robot.png
|
||||
|
||||
## Explain a repository by reading its code
|
||||
|
||||
Scenario: You want to understand how a popular open-source utility works by inspecting its code, not just its README.
|
||||
Scenario: You want to understand how a popular open-source utility works by
|
||||
inspecting its code, not just its README.
|
||||
|
||||
Give Gemini CLI the following prompt:
|
||||
|
||||
@@ -42,25 +45,37 @@ Clone the 'chalk' repository from https://github.com/chalk/chalk, read its key s
|
||||
|
||||
Result: Gemini will perform a sequence of actions to answer your request.
|
||||
|
||||
1. First, it will ask for permission to run `git clone` to download the repository.
|
||||
2. Next, it will find the important source files and ask for permission to read them.
|
||||
1. First, it will ask for permission to run `git clone` to download the
|
||||
repository.
|
||||
2. Next, it will find the important source files and ask for permission to read
|
||||
them.
|
||||
3. Finally, after analyzing the code, it will provide a summary.
|
||||
|
||||
Gemini CLI will return an explanation based on the actual source code:
|
||||
|
||||
```markdown
|
||||
The `chalk` library is a popular npm package for styling terminal output with colors. After analyzing the source code, here's how it works:
|
||||
The `chalk` library is a popular npm package for styling terminal output with
|
||||
colors. After analyzing the source code, here's how it works:
|
||||
|
||||
- **Core Functionality:** The main file sets up a chainable API. Each color or modifier (like `bold` or `italic`) is a getter that appends the corresponding ANSI escape code to an internal stack.
|
||||
- **Core Functionality:** The main file sets up a chainable API. Each color or
|
||||
modifier (like `bold` or `italic`) is a getter that appends the corresponding
|
||||
ANSI escape code to an internal stack.
|
||||
|
||||
- **Chainable API:** When you call `chalk.red.bold('Hello')`, you are accessing getters. The `red` getter adds the red color code, and the `bold` getter adds the bold code.
|
||||
- **Chainable API:** When you call `chalk.red.bold('Hello')`, you are accessing
|
||||
getters. The `red` getter adds the red color code, and the `bold` getter adds
|
||||
the bold code.
|
||||
|
||||
- **Output Generation:** When the chain is treated as a string (e.g., in `console.log`), a final `toString()` method is called. This method joins all the stored ANSI codes, wraps them around the input string ('Hello'), and adds a reset code at the end. This produces the final, styled string that the terminal can render.
|
||||
- **Output Generation:** When the chain is treated as a string (e.g., in
|
||||
`console.log`), a final `toString()` method is called. This method joins all
|
||||
the stored ANSI codes, wraps them around the input string ('Hello'), and adds
|
||||
a reset code at the end. This produces the final, styled string that the
|
||||
terminal can render.
|
||||
```
|
||||
|
||||
## Combine two spreadsheets into one spreadsheet
|
||||
|
||||
Scenario: You have two .csv files: `Revenue - 2023.csv` and `Revenue - 2024.csv`. Each file contains monthly revenue figures, like so:
|
||||
Scenario: You have two .csv files: `Revenue - 2023.csv` and
|
||||
`Revenue - 2024.csv`. Each file contains monthly revenue figures, like so:
|
||||
|
||||
```csv
|
||||
January,0
|
||||
@@ -85,7 +100,9 @@ Give Gemini CLI the following prompt:
|
||||
Combine the two .csv files into a single .csv file, with each year a different column.
|
||||
```
|
||||
|
||||
Result: Gemini CLI will read each file and then ask for permission to write a new file. Provide your permission and Gemini CLI will provide the following .csv:
|
||||
Result: Gemini CLI will read each file and then ask for permission to write a
|
||||
new file. Provide your permission and Gemini CLI will provide the following
|
||||
.csv:
|
||||
|
||||
```csv
|
||||
Month,2023,2024
|
||||
@@ -105,7 +122,8 @@ December,2100,9000
|
||||
|
||||
## Run unit tests
|
||||
|
||||
Scenario: You've written a simple login page. You wish to write unit tests to ensure that your login page has code coverage.
|
||||
Scenario: You've written a simple login page. You wish to write unit tests to
|
||||
ensure that your login page has code coverage.
|
||||
|
||||
Give Gemini CLI the following prompt:
|
||||
|
||||
@@ -113,7 +131,8 @@ Give Gemini CLI the following prompt:
|
||||
Write unit tests for Login.js.
|
||||
```
|
||||
|
||||
Result: Gemini CLI will ask for permission to write a new file and create a test for your login page
|
||||
Result: Gemini CLI will ask for permission to write a new file and create a test
|
||||
for your login page
|
||||
|
||||
```javascript
|
||||
import React from 'react';
|
||||
|
||||
Reference in New Issue
Block a user