Tool for searching the web on the CLI
Find a file
2024-12-07 11:28:56 +00:00
cmd/search Update usage message in search command to provide options and usage instructions 2024-12-07 11:19:14 +00:00
internal Initial Commit 2024-12-07 11:08:15 +00:00
.gitignore Initial Commit 2024-12-07 11:08:15 +00:00
go.mod Initial Commit 2024-12-07 11:08:15 +00:00
Makefile Initial Commit 2024-12-07 11:08:15 +00:00
README.md Update README to reflect correct command for mise 2024-12-07 11:28:56 +00:00

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -am 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request