rick-cli 0.2.1

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>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/version-0.2.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.

---

## 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
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
rick -o response.json https://api.example.com/data

# See what's happening
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. 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) |

### 3. 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.

### 4. 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)
  -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
  -h, --help              Print help
```

---

## 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
# >
# < HTTP/1.1 200 OK
# < content-type: application/json
# ...
```

### Include response headers

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

---

## 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` |
| 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 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
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

- [ ] Progress bar for large downloads
- [ ] Timeout configuration (`--timeout`)
- [ ] Retry logic (`--retry`)
- [ ] Read body from file (`--json @file.json`)
- [ ] Response time display
- [ ] Config file for defaults

**Not planned:**
- Other protocols (FTP, etc.)
- Cookie jars
- .netrc support
- 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>