Tool for searching the web on the CLI
| cmd/search | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| Makefile | ||
| README.md | ||
Search CLI
A command-line interface for searching using Serper and Tavily APIs.
Features
- Search using Google (via Serper API)
- Search and extract content using Tavily API
- JSON output support
- Configurable search depth (for Tavily)
Installation
Using Go Install
go install github.com/regismesquita/search-cli/cmd/search@latest
Using mise (formerly rtx)
mise use go:github.com/regismesquita/search-cli/cmd/search@latest
From Source
# Clone the repository
git clone https://github.com/regismesquita/search-cli
cd search-cli
# Build and install
make build
make install # Installs to ~/go/bin
# or
make local-install # Installs to /usr/local/bin (requires sudo)
Configuration
Set your API keys as environment variables:
# For Serper
export SERPER_API_KEY=your_key_here
# For Tavily
export TAVILY_API_KEY=your_key_here
Usage
Basic Search (using Serper)
# Default search using Serper
search "your query"
# or explicitly
search -s "your query"
Using Tavily
# Basic search
search -t "your query"
# Advanced search
search -t -depth advanced "your query"
# Extract content from URLs
search -t -e "https://example.com"
JSON Output
search -json "your query"
search -t -json "your query"
search -t -e -json "https://example.com"
Options
-s: Use Serper (default)-t: Use Tavily-e: Extract content (Tavily only)-json: Output in JSON format-depth: Search depth for Tavily (basic or advanced)
Development
# Run tests
make test
# Run tests with coverage
make test-coverage
# Run linter
make lint
# Clean build artifacts
make clean
Project Structure
.
├── cmd/
│ └── search/ # Main application
│ └── main.go
├── internal/
│ ├── adapters/ # API providers
│ │ ├── serper.go
│ │ ├── tavily.go
│ │ └── types.go
│ └── formatter/ # Output formatting
│ └── formatter.go
├── go.mod
└── Makefile
License
MIT
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -am 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request