curlie

repository·master·Indexed 23 days ago

https://github.com/rs/curlie

A command-line interface frontend to curl that combines curl's feature set with the intuitive syntax and output formatting of httpie. It provides automatic JSON handling, pretty-printed output, and the ability to inspect generated curl commands via the --curl flag.

Tokens
672
Snippets
1
Records
6
Agent score
37%

What's inside curlie

  1. Install Curlie

    master

    Curlie can be installed via several package managers depending on your operating system:

    macOS / Linux

    • Homebrew: brew install curlie
    • Webinstall: curl -sS https://webinstall.dev/curlie | bash
    • MacPorts: sudo port install curlie
    • Pkg (FreeBSD): pkg install curlie
    • Go: go install github.com/rs/curlie@latest
    • Mise: mise use -g curlie@latest

    Windows

    • Webinstall: curl.exe -A "MS" https://webinstall.dev/curlie | powershell
    • Scoop: scoop install curlie

    Ubuntu/Debian

    • eget:
      1. Download deb: eget rs/curlie -a deb --to=curlie.deb
      2. Install: sudo dpkg -i curlie.deb

    Alternatively, you can download a binary package directly from the releases page.

  2. Implicit method selection based on binary name

    master

    If you rename the curlie binary to match a specific HTTP method, curlie will automatically set that method using the -X flag if no other method is specified:

    • Renaming to post, put, or delete will automatically add -X post, -X put, or -X delete.
    • Renaming to head will automatically add -I (to fetch headers only).
  3. Automatic JSON handling in curlie

    master

    By default, curlie optimizes for JSON interaction:

    • Content-Type: If you provide input data (via -d or stdin) but do not specify a Content-Type header, curlie automatically adds -H "Content-Type: application/json".
    • Accept Header: If no Accept header is provided, curlie automatically adds -H "Accept: application/json, */*".
    • Formatting: If the output is sent to a terminal, curlie automatically applies JSON colorization and formatting to the response body.
    • Binary Protection: curlie includes a BinaryFilter to prevent garbled output if the response is binary data.
  4. Debug curlie by inspecting the generated curl command

    master

    If you want to see exactly what curl command curlie is constructing and executing under the hood, use the --curl flag. This will print the command to stdout and exit without running it.

    curlie --curl <your-args>
  5. Use Curlie CLI

    master

    Curlie is a frontend to curl that provides HTTPie-inspired syntax sugar while exposing all curl options.

    Synopsis: curlie [CURL_OPTIONS...] [METHOD] URL [ITEM [ITEM]]

    Key Features:

    • JSON Formatting: Provides pretty-printed output for JSON by default. To force pretty-printing, use the --pretty flag.
    • Debugging: Use the --curl option to print the exact curl command that was executed.
    • Output Streams: Headers are written to stderr (unlike HTTPie which uses stdout), and output is not buffered, allowing for real-time debugging of streamed data.