rick-cli 0.2.1

A better cURL, written in Rust
# rick Design Decisions

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

## Philosophy
Build something I'd actually use instead of cURL. Not feature parity — better ergonomics for common cases.

---

## v0.1 - The Simplest Thing
Just `rick <url>` → prints response body. No flags, no options.

---

## v0.2 - Core Features

### Headers: `-H` / `--header`
**Decision: Keep cURL's syntax**

cURL: `curl -H "Authorization: Bearer token" URL`
rick: `rick -H "Authorization: Bearer token" URL`

Why copy cURL? Because `-H` for header is muscle memory. No reason to be different here.

### HTTP Method: Auto-detect with `-X` override
**Decision: Smarter defaults than cURL**

cURL requires `-X POST` even when you provide data.
rick: If you provide `-d` or `--json`, method is POST automatically. Use `-X` only when you need something else (PUT, PATCH, DELETE).

### POST Data: `-d` / `--data`
**Decision: Keep cURL's syntax**

Familiar, no reason to change.

### JSON: `--json` (NEW - not in cURL)
**Decision: Better than cURL**

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

rick way:
```bash
rick --json '{"key": "value"}' URL
```

`--json` does two things:
1. Sets `Content-Type: application/json` automatically
2. Sets `Accept: application/json` automatically
3. Takes the body as its argument

This is the kind of ergonomic win that makes rick worth using.

### Output to File: `-o` / `--output`
**Decision: Keep cURL's syntax**

`rick -o file.txt URL` — familiar, works the same.

---

## v0.3 - Response Information

### Show Headers: `-i` / `--include`
**Decision: Keep cURL's syntax**

Shows response headers before body.

### Verbose: `-v` / `--verbose`
**Decision: Keep cURL's syntax**

Shows request AND response headers.

---

## Future Considerations

### Other Protocols (FTP, etc.)
**Decision: HTTP(S) only**

cURL supports ~25 protocols. rick is HTTP(S) only. If you need FTP, use... something else. This keeps the codebase simple and the binary small.

### Progress Bar
Maybe. For large downloads `-o` should probably show progress. But keep it optional.

### Follow Redirects
**Decision: Follow by default (opposite of cURL!)**

cURL doesn't follow redirects by default (`-L` to enable).
rick follows redirects by default. Use `--no-follow` to disable.

Why? Because 99% of the time you want to follow redirects. The cURL default is a historical artifact.

---

## Summary: Where rick differs from cURL

| Feature | cURL | rick | Why |
|---------|------|------|-----|
| JSON body | `-H "Content-Type: application/json" -d '{}'` | `--json '{}'` | Less typing |
| Method with data | Need `-X POST -d` | Just `-d` (auto POST) | Smarter default |
| Redirects | Don't follow (need `-L`) | Follow by default | Modern default |
| Protocols | 25+ | HTTP(S) only | Simplicity |

---

## Trade-offs

### Binary Size
- rick: ~6.8 MB (statically linked with TLS)
- curl: ~540 KB (dynamically linked to system libs)

The size difference comes from:
1. Rust statically links most dependencies
2. We include a full TLS stack (rustls)
3. curl relies on system OpenSSL

This is acceptable because:
- Disk is cheap
- No dependency hell — rick works on any machine
- Startup time is still instant

### Dependencies
Using `reqwest` with blocking mode. Could use raw `hyper` for smaller binary, but reqwest handles cookies, redirects, and edge cases correctly out of the box.

---

## What's Implemented (v0.2)

```
rick <url>                          # GET request
rick -X PUT <url>                   # Explicit method
rick -H "Auth: Bearer x" <url>      # Custom header
rick -d "data" <url>                # POST with data (auto-detects POST)
rick --json '{"k":"v"}' <url>       # JSON POST (sets headers automatically)
rick -o file.txt <url>              # Save to file
rick -i <url>                       # Include response headers
rick -v <url>                       # Verbose (show request + response headers)
rick --no-follow <url>              # Don't follow redirects
```

---

## Why use rick instead of cURL?

1. **`--json` flag**: One flag instead of two (`-H` + `-d`)
2. **Smart defaults**: POST auto-detected, redirects followed
3. **No 30-year legacy**: Clean, predictable behavior
4. **Single binary**: No dependencies, works everywhere