rick-cli 0.3.0

A better cURL, written in Rust
<p align="center">
  <img src="https://em-content.zobj.net/source/apple/391/man-technologist-light-skin-tone_1f468-1f3fb-200d-1f4bb.png" width="120" alt="rick logo">
</p>

<h1 align="center">rick</h1>

<p align="center">
  <strong>A better cURL, written in Rust.</strong><br>
  <sub>For people who are tired of typing <code>-H "Content-Type: application/json"</code></sub>
</p>

<p align="center">
  <a href="#installation">Installation</a><a href="#quick-start">Quick Start</a><a href="#why-rick">Why rick?</a><a href="#usage">Usage</a><a href="#vs-curl">vs cURL</a><a href="#roadmap">Roadmap</a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/version-0.3.0-blue.svg" alt="Version">
  <img src="https://img.shields.io/badge/rust-1.75%2B-orange.svg" alt="Rust">
  <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License">
  <img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg" alt="Platform">
</p>

---

## The Problem

You want to POST some JSON. Here's cURL:

```bash
curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"name": "rick"}' https://api.example.com/users
```

Here's rick:

```bash
rick --json '{"name": "rick"}' https://api.example.com/users
```

**That's it.** That's the whole pitch.

---

## What's New in v0.3.0

**Colors & Typography** — rick now has beautiful terminal output:

- **JSON syntax highlighting** — Keys, strings, numbers, booleans all in distinct colors
- **Colored HTTP status codes** — Green (2xx), Yellow (3xx), Red (4xx/5xx)
- **Method colors** — GET=green, POST=blue, PUT/PATCH=yellow, DELETE=red
- **Progress indicators** — Spinner during requests, progress bar for large downloads
- **Smart color detection** — Auto-disables for pipes/CI, respects `NO_COLOR` env

```bash
# Pretty JSON with colors (automatic when outputting to terminal)
rick https://api.github.com/users/octocat

# Force pretty-print without colors
rick --pretty --no-color https://api.github.com/users/octocat

# Verbose mode shows colored request/response flow
rick -v https://httpbin.org/get
```

---

## Installation

### Pre-built binaries (recommended)

Download the latest release for your platform:

```bash
# macOS (Apple Silicon)
curl -L https://github.com/beratcano/rick/releases/latest/download/rick-macos-arm64.tar.gz | tar xz
sudo mv rick-macos-arm64 /usr/local/bin/rick

# macOS (Intel)
curl -L https://github.com/beratcano/rick/releases/latest/download/rick-macos-x86_64.tar.gz | tar xz
sudo mv rick-macos-x86_64 /usr/local/bin/rick

# Linux (x86_64)
curl -L https://github.com/beratcano/rick/releases/latest/download/rick-linux-x86_64.tar.gz | tar xz
sudo mv rick-linux-x86_64 /usr/local/bin/rick

# Linux (ARM64)
curl -L https://github.com/beratcano/rick/releases/latest/download/rick-linux-arm64.tar.gz | tar xz
sudo mv rick-linux-arm64 /usr/local/bin/rick
```

Or download manually from [Releases](https://github.com/beratcano/rick/releases).

### From source

```bash
git clone https://github.com/beratcano/rick
cd rick
cargo build --release
sudo cp target/release/rick /usr/local/bin/
```

### Cargo

```bash
cargo install rick-cli
```

---

## Quick Start

```bash
# GET request (with JSON syntax highlighting!)
rick https://api.github.com/users/octocat

# POST JSON (the killer feature)
rick --json '{"title": "Hello", "body": "World"}' https://api.example.com/posts

# Custom headers
rick -H "Authorization: Bearer token123" https://api.example.com/me

# Save response to file (with progress bar for large files)
rick -o response.json https://api.example.com/data

# See what's happening (colored request/response)
rick -v https://api.example.com/debug
```

---

## Why rick?

### 1. `--json` flag

The single feature that justifies rick's existence.

```bash
# cURL (pain)
curl -H "Content-Type: application/json" -H "Accept: application/json" -d '{"key": "value"}' URL

# rick (joy)
rick --json '{"key": "value"}' URL
```

### 2. Beautiful output

JSON responses are automatically syntax-highlighted. Status codes are colored. Errors come with helpful hints.

### 3. Smart defaults

| Behavior | cURL | rick |
|----------|------|------|
| Follow redirects | No (`-L` to enable) | **Yes** (`--no-follow` to disable) |
| POST when data provided | No (`-X POST` required) | **Yes** (auto-detected) |
| Colored output | No | **Yes** (auto-detected) |

### 4. HTTP-focused

cURL supports 25+ protocols (FTP, LDAP, SMTP, Gopher...). rick supports HTTP and HTTPS. That's it. This keeps the codebase simple, the binary small, and the mental model clear.

### 5. Zero dependencies

Single static binary. No OpenSSL. No system libraries. Download and run.

---

## Usage

```
rick [OPTIONS] <URL>

Arguments:
  <URL>  URL to request

Options:
  -X, --method <METHOD>   HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
  -H, --header <HEADER>   Add header (can be used multiple times)
  -d, --data <DATA>       Request body
      --json <JSON>       JSON body (sets Content-Type & Accept automatically)
  -o, --output <FILE>     Write response to file
  -i, --include           Show response headers
  -v, --verbose           Show request and response headers
      --no-follow         Don't follow redirects
      --pretty            Pretty print JSON response
      --color <MODE>      Color mode: auto, always, never [default: auto]
      --no-color          Disable colors (same as --color=never)
  -h, --help              Print help
  -V, --version           Print version
```

---

## Examples

### GET request

```bash
rick https://httpbin.org/get
```

### POST with form data

```bash
rick -d "username=rick&password=morty" https://httpbin.org/post
```

### POST JSON

```bash
rick --json '{"dimension": "C-137"}' https://httpbin.org/post
```

### Custom headers

```bash
rick -H "Authorization: Bearer abc123" -H "X-Custom: value" https://api.example.com
```

### PUT request

```bash
rick -X PUT --json '{"updated": true}' https://api.example.com/resource/1
```

### Download file

```bash
rick -o image.png https://example.com/image.png
```

### Debug request/response

```bash
rick -v https://httpbin.org/get
# > GET https://httpbin.org/get HTTP/1.1    (green GET)
# >
# < HTTP/1.1 200 OK                          (green 200)
# < content-type: application/json
# ...
```

### Include response headers

```bash
rick -i https://httpbin.org/get
# HTTP/1.1 200 OK
# content-type: application/json
# ...
#
# {"args": {}, ...}
```

### Disable colors for piping

```bash
# Automatic (colors disabled when piping)
rick https://httpbin.org/json | jq .

# Explicit
rick --no-color https://httpbin.org/json > response.json

# Or use NO_COLOR environment variable
NO_COLOR=1 rick https://httpbin.org/json
```

---

## vs cURL

| Feature | cURL | rick |
|---------|------|------|
| JSON POST | `-H "Content-Type: application/json" -d '{}'` | `--json '{}'` |
| Follow redirects | Need `-L` | Default behavior |
| Auto-detect POST | Need `-X POST` | Automatic with `-d`/`--json` |
| Colored output | No | Yes (automatic) |
| JSON highlighting | No | Yes |
| Progress bars | Basic | Modern with ETA |
| Protocols | 25+ | HTTP(S) only |
| Binary size | ~540 KB (dynamic) | ~7 MB (static) |
| Dependencies | OpenSSL, libcurl, etc. | None |

### When to use cURL instead

- You need FTP, SFTP, SCP, or other protocols
- You need advanced features (cookies file, netrc, proxy auth)
- You're writing a shell script that must work everywhere
- Binary size is critical

### When to use rick

- 99% of your API testing
- You're tired of the JSON header dance
- You want sane defaults
- You want beautiful terminal output
- You want a single static binary

---

## Name

**rick** = **R**ust **I**ntegrated **C**url + **K** (for fun)

Yes, it should be "ric" but that looked weird.

---

## Design Philosophy

1. **Optimize for the common case** — JSON APIs are everywhere, make them easy
2. **Respect muscle memory** — Keep familiar flags (`-H`, `-d`, `-o`, `-v`, `-i`, `-X`)
3. **Modern defaults** — Follow redirects, auto-detect methods, colorful output
4. **Do one thing well** — HTTP only, no feature creep

See [DECISIONS.md](DECISIONS.md) for detailed design rationale.

---

## Building from source

```bash
# Clone
git clone https://github.com/beratcano/rick
cd rick

# Build
cargo build --release

# Run tests
cargo test

# Install locally
cargo install --path .
```

### Requirements

- Rust 1.75 or later
- That's it

---

## Contributing

Contributions are welcome! Please read the guidelines:

1. **Keep it simple** — rick is intentionally minimal
2. **Discuss first** — Open an issue before adding features
3. **Document decisions** — Update DECISIONS.md for non-trivial changes

```bash
# Format code
cargo fmt

# Run clippy
cargo clippy

# Run tests
cargo test
```

---

## Roadmap

We're actively developing rick. Here's what's coming:

| Version | Focus | Status |
|---------|-------|--------|
| v0.3.0 | Colors & Typography | Done |
| v0.4.0 | Performance & Benchmarks | Up next |
| v0.5.0 | Quality of Life | Planned |
| v0.6.0 | Advanced Features | Planned |

### v0.4.0 Highlights (Up Next)
- Benchmark suite against cURL
- `--time` flag to show request duration
- Response time breakdown (DNS, connect, TLS, first byte)

**Want to contribute?** Check out [ROADMAP.md](ROADMAP.md) for the full plan and pick something to work on!

**Not planned:** Other protocols, cookie jars, feature parity with cURL.

---

## License

MIT License — do whatever you want.

---

<p align="center">
  <sub>Built with Rust and a mass hatred of typing Content-Type headers</sub>
</p>