1 unstable release
Uses new Rust 2024
0.1.0 | Mar 16, 2025 |
---|
#433 in Command line utilities
102 downloads per month
16KB
105 lines
brave-cli
A command-line interface for the Brave Search API that retrieves search results and outputs them as JSON.
Features
- Search the web using Brave Search API
- Output results in clean JSON format
- Handle gzip-compressed API responses
- Configurable number of results
Installation
Make sure you have Rust and Cargo installed. Then build the project:
cargo build --release
The executable will be available at target/release/brave-cli
.
Usage
First, set your Brave Search API key as an environment variable:
export BRAVE_API_KEY=your_api_key_here
Then run a search:
brave-cli -q "your search query"
Options
-q, --query <QUERY>
: Search query (required)-c, --count <COUNT>
: Number of results to return (default: 10)
Output Format
The output is a JSON object with a results
array containing search results:
{
"results": [
{
"title": "Result title",
"url": "https://example.com/result",
"description": "Description of the result"
},
...
]
}
Getting a Brave Search API Key
To use this tool, you need a Brave Search API key. You can get one by:
- Visiting the Brave Search API page
- Creating an account or signing in
- Following the instructions to obtain an API key
License
This project is open source and available under the MIT License.
Dependencies
~8–24MB
~256K SLoC