The power of curl, the ease of use of httpie.

Curlie

If you like the interface of HTTPie but miss the features of curl, curlie is what you are searching for. Curlie is a frontend to curl that adds the ease of use of httpie, without compromising on features and performance. All curl options are exposed with syntax sugar and output formatting inspired from httpie.

Install

Using homebrew:

brew install rs/tap/curlie

Using pkg:

pkg install curlie

Or download a binary package.

Usage

Synopsis:

$ curlie [CURL_OPTIONS...] [METHOD] URL [ITEM [ITEM]]

Simple GET:

Custom method, headers and JSON data:

Build

Build with goreleaser to test that all platforms compile properly.

goreleaser --snapshot --skip-publish --rm-dist

Or with go build for your current platform only.

go build .

Differences with httpie

  • Like curl but unlike httpie, headers are written on stderr instead of stdout.
  • Output is not buffered, all the formatting is done on the fly so you can easily debug streamed data.
  • Use the --curl option to print executed curl command.

License

All source code is licensed under the MIT License.

Owner
Olivier Poitrey
Director of Engineering at Netflix Co-Founder & ex-CTO of Dailymotion Co-Founder of NextDNS
Olivier Poitrey
Comments
  • Allow plain curl input?

    Allow plain curl input?

    I like the output formatting or Curlie and also its HTTPie-like syntax sugar but sometimes, I have a curl command in my clipboard and would love to paste it to Curlie, something like this:

    curlie --raw -H 'Some-Header: ABC' https://example.com
    

    Do you think this would be possible? I can imagine some challenges around various curl flags but generally, it would be very useful if Curlie understood some of the basic curl switches.

  • Cut a new release for v1.4.1

    Cut a new release for v1.4.1

    Would you mind cutting a new release for v1.4.1?

    Tokens directly available at https://github.com/settings/tokens

    export GITHUB_TOKEN=xxxx
    
    git clone [email protected]:rs/curlie.git
    pushd curlie
        git tag -a v1.4.1 -m "Windows, color, and version updates"
        git push --tags
    
        goreleaser
    

    I realize that you've done this several times already, but I thought giving the copy/paste might make it more convenient.

  • Re: #22 add version output

    Re: #22 add version output

    • Add version from git tags (must be built with go generate ./...).
      curlie version
      
      curlie v1.4.1-pre0+dirty (2020-09-12T02:46:46-06:00)
      
    • Do not generate Linux-specific args.go on darwin.
    • Ignore xversion.go (so that clean tags will produce clean output)
  • How to tell installed version?

    How to tell installed version?

    I'm working on publishing curlie to https://webinstall.dev/curlie (and I'll PR as an additional install method once I'm done), but I need to know what version of curlie is presently installed to know whether or not to re-install a new version.

    How can I tell which version is the installed version?

    This gives me the curl version only:

    curlie --version
    
  • Allow disabling reading from `stdin`

    Allow disabling reading from `stdin`

    When using curlie in a script, I have an issue due those lines where it unconditionally tries to read from stdin, even if I try to close the standard input in my script before calling curlie.

    Due to the way the endpoint I'm trying to call works, this leads to a 404 because of it.

    A flag to disable that automatic behavior sounds like a good fix to me.

  • When using form params, transform values to form fields

    When using form params, transform values to form fields

    Httpie is smart enough to transform requests with the --form flag into actual form requests. Instead of parsing their arguments as JSON, they parse them as form fields. This commit enables the same thing for curlie

    Note: This is my first time using Go in any capacity and my mastery of curl is pretty lacking, so feel free to cancel this in favor of some other approach. I'm also open to any feedback

  • Incorrect version info in `--version`

    Incorrect version info in `--version`

    curlie --version shows

    curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
    Release-Date: 2022-03-05
    

    instead of

    curlie 1.6.7 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
    Release-Date: 2022-03-05
    
  • Same command works in curlie but not in curl

    Same command works in curlie but not in curl

    I am trying to run a POST request in vanilla cURL, but failing at it. I can easily run it in curlie (I expect the 500):

    $ curlie -v -H 'X-SLURM-USER-TOKEN: someLongToken' -H 'X-SLURM-USER-NAME: lmdamato' -X POST -d '{"job":{"environment":{"LD_LIBRARY_PATH":"/lib/:/lib64/:/usr/local/lib","PATH":"/bin:/usr/bin/:/usr/local/bin/"},"name":"my_test_hello_world_job","partition":"QT","qos":"medium"},"script":"#!/bin/bash\n/bin/hostname"}' http://myslurmhost:6820/slurm/v0.0.37/job/submit
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to myslurmhost (127.0.0.1) port 6820 (#0)
    POST /slurm/v0.0.37/job/submit HTTP/1.1
    Host: myslurmhost:6820
    User-Agent: curl/7.61.1
    X-SLURM-USER-TOKEN: someLongToken
    X-SLURM-USER-NAME: lmdamato
    Content-Type: application/json
    Accept: application/json, */*
    Content-Length: 217
    
    {
        "job": {
            "environment": {
                "LD_LIBRARY_PATH": "/lib/:/lib64/:/usr/local/lib",
                "PATH": "/bin:/usr/bin/:/usr/local/bin/"
            },
            "name": "my_test_hello_world_job",
            "partition": "QT",
            "qos": "medium"
        },
        "script": "#!/bin/bash\n/bin/hostname"
    }
    
    
    * upload completely sent off: 217 out of 217 bytes
    HTTP/1.1 500 INTERNAL ERROR
    Connection: Close
    Content-Length: 385
    Content-Type: application/json
    
    * Closing connection 0
    {
        "meta": {
            "plugin": {
                "type": "openapi\/v0.0.37",
                "name": "Slurm OpenAPI v0.0.37"
            },
            "Slurm": {
                "version": {
                    "major": 21,
                    "micro": 7,
                    "minor": 8
                },
                "release": "21.08.7"
            }
        },
        "errors": [
            {
                "error_code": 5005,
                "error": "Zero Bytes were transmitted or received"
            }
        ]
    }
    

    But the exact same command in vanilla cURL won't work:

    $ curl -v -H 'X-SLURM-USER-TOKEN: someLongToken' -H 'X-SLURM-USER-NAME: lmdamato' -X POST -d '{"job":{"environment":{"LD_LIBRARY_PATH":"/lib/:/lib64/:/usr/local/lib","PATH":"/bin:/usr/bin/:/usr/local/bin/"},"name":"my_test_hello_world_job","partition":"QT","qos":"medium"},"script":"#!/bin/bash\n/bin/hostname"}' http://myslurmhost:6820/slurm/v0.0.37/job/submit
    Note: Unnecessary use of -X or --request, POST is already inferred.
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to myslurmhost (127.0.0.1) port 6820 (#0)
    > POST /slurm/v0.0.37/job/submit HTTP/1.1
    > Host: myslurmhost:6820
    > User-Agent: curl/7.61.1
    > Accept: */*
    > X-SLURM-USER-TOKEN: someLongToken
    > X-SLURM-USER-NAME: lmdamato
    > Content-Length: 217
    > Content-Type: application/x-www-form-urlencoded
    > 
    * upload completely sent off: 217 out of 217 bytes
    < HTTP/1.1 400 BAD REQUEST
    < Connection: Close
    < Content-Length: 22
    < Content-Type: text/plain
    < 
    * Closing connection 0
    Unable to parse query.
    

    Can someone help me understand why?

  • curl option --aws-sigv4 values get interpreted as headers

    curl option --aws-sigv4 values get interpreted as headers

    When I am using the newer curl option aws-sigv4, curlie interprets it as headers:

    curlie https://REDACTED.execute-api.eu-west-1.amazonaws.com/REDACTED --curl --aws-sigv4 "aws:amz:eu-west-1" --user "$(aws configure get aws_access_key_id):$(aws configure get aws_secret_access_key)"
    
    curl --aws-sigv4 --user REDACTED:REDACTED -H aws:amz:eu-west-1 https://REDACTED.execute-api.eu-west-1.amazonaws.com/REDACTED -s -S -v -H "Accept: application/json, */*"
    
  • Fixed junk output in windows console. (#29)

    Fixed junk output in windows console. (#29)

    Fixed issue #29

    For windows runtime, added originalMode or ENABLE_VIRTUAL_TERMINAL_PROCESSING in SetConsoleMode, and if case of any error, disabled color print.

  • Command PATH security when calling curl program

    Command PATH security when calling curl program

    The current version of the code forwards all operations to curl using exec.Command which has been found to be vulnerable to an issue involving PATH lookups in untrusted directories that can lead to remote execution. The vulnerability is well described in the following blog post written by Russ Cox on Jan 19th, 2021 → Command PATH security in Go.

  • Feature Request: Session Support

    Feature Request: Session Support

    curl allows users to support cookie based sessions with the --cookie-jar and --cookie flags.

    httpie has similar functionality with the --session flag.

    Are there any plans to add similar functionality with curlie?

    If there is already a way to do this (since curlie is a wrapper around curl), I'm not seeing a way to do this in the docs.

  • application/json accept header included even when no data passed

    application/json accept header included even when no data passed

    When no explicit Accept header nor any json payload (e.g., foo=bar, quz=42) are specified in the request, the following is a difference in handling wrt httpie:

    $ curlie -v get http://example.net
    * ...
    GET / HTTP/1.1
    Host: example.net
    User-Agent: curl/7.64.1
    Accept: application/json, */*
    
    HTTP/1.1 200 OK
    ...
    

    That is, curlie includes and gives preference to application/json in the Accept header in these cases. In contrast, httpie simply includes Accept: */*, which seems more flexible in general:

    $ http -v get http://example.net
    GET / HTTP/1.1
    Accept: */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Host: example.net
    User-Agent: HTTPie/3.2.1
    ...
    

    fwiw, CURL itself also just includes Accept: */*:

    ➜  ~ curl -v http://example.net
    *   Trying 2606:2800:220:1:248:1893:25c8:1946...
    * TCP_NODELAY set
    * Connected to example.net (2606:2800:220:1:248:1893:25c8:1946) port 80 (#0)
    > GET / HTTP/1.1
    > Host: example.net
    > User-Agent: curl/7.64.1
    > Accept: */*
    >
    ...
    
  • Supply default options via environment variable

    Supply default options via environment variable

    Thank you for curlie ❤️ I find myself stumbling over curl's behavior of returning a 0 exit code when a >= 400 status code was returned from the server. The -f parameters solves that issue for me but supplying it to every curlie command is tedious. I was wondering whether you'd find it acceptable to supply parameters via environment variables or even a configuration file.

  • fix headers/body order in console

    fix headers/body order in console

    Normally curlie returns output like that (as expected):

    [mateusz@arch curlie (fix)]$ curlie localhost:8080
    HTTP/1.1 200 OK
    Date: Fri, 20 May 2022 19:35:04 GMT
    Content-Length: 30
    Content-Type: text/plain; charset=utf-8
    
    Hello
    Hello
    Hello
    Hello
    Hello
    

    But sometimes it returns like so: (around 5% of responses)

    [mateusz@arch curlie (fix)]$ curlie localhost:8080
    Hello
    Hello
    Hello
    Hello
    Hello
    HTTP/1.1 200 OK
    Date: Fri, 20 May 2022 19:35:40 GMT
    Content-Length: 30
    Content-Type: text/plain; charset=utf-8
    

    For me it only happens when querying localhost (probably because of the low latency??). This PR fixes it.

Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!

Got. Simple and fast concurrent downloader. Installation ❘ CLI Usage ❘ Module Usage ❘ License Comparison Comparison in cloud server: [root@centos-nyc-

Dec 29, 2022
convert curl commands to Python, JavaScript, Go, PHP, R, Dart, Java, MATLAB, Rust, Elixir and more
convert curl commands to Python, JavaScript, Go, PHP, R, Dart, Java, MATLAB, Rust, Elixir and more

curlconverter curlconverter transpiles curl commands into programs in other programming languages. $ curlconverter --data "Hello, world!" example.com

Jan 2, 2023
CLI client for docat, Manage your docat documentation with ease.
CLI client for docat, Manage your docat documentation with ease.

docatl, the docat cli Manage your docat documentation with ease. Getting Started Download the latest Release binary for your platform and start pushin

Nov 10, 2022
Start Go command line apps with ease
Start Go command line apps with ease

Start Start Go command line apps with ease Executive Summary The start package for Go provides two basic features for command line applications: Read

Oct 29, 2021
An easy to use menu structure for cli applications that prompts users to make choices.
An easy to use menu structure for cli applications that prompts users to make choices.

WMenu Package wmenu creates menus for cli programs. It uses wlog for its interface with the command line. It uses os.Stdin, os.Stdout, and os.Stderr w

Dec 26, 2022
A wrapper around cd and xdg-open to use aliases to directory paths in terminal

CDD - Change directories Dynamically I am a lazy linux user and turns out that basic tab completion wasn't enough for me to navigate through my direct

Dec 15, 2022
Simple and easy to use command line application written in Go for cleaning unnecessary XCode files.

xcclear Say hello to a few extra gigabytes of space on your Mac with xcclear, a simple and easy to use command line application written in Go for clea

Dec 16, 2022
Vim made in Go that you shouldn't use.

novavim This is my attempt at making Vim from scratch in Go, meaning this project will utilize no libs outside of the Go standard library: no ncurses,

Aug 4, 2022
An easy-to-use cli tool for downloading manga
An easy-to-use cli tool for downloading manga

mangodl Download and search manga right from the terminal! Report Bug || Request Feature Table of Contents About the Project Built With Getting Starte

Nov 26, 2022
A CLI tool that you can use create regular backups of your Notion.so Pages.

notion-offliner A CLI tool that you can use create regular backups of your Notion.so Pages. Perfect for disaster scenarios and offline usage. MacOS an

Jan 3, 2023
sg is the CLI tool that Sourcegraph developers can use to develop Sourcegraph.

sg is the CLI tool that Sourcegraph developers can use to develop Sourcegraph.

Dec 14, 2022
A simple CLI tool to use the _simulate API of elasticsearch to quickly test pipelines

elasticsearch-pipeline-tester A simple CLI tool to use the _simulate API of elasticsearch to quickly test pipelines usage: pipelinetester [<flags>] <p

Oct 19, 2021
This tool is a CLI-interactive tool for TA who use eeclass platform

NTHU eeclass TA helper. This tool is a CLI-interactive tool for TA who use eeclass platform. It helps TA to download all the submitted homework, and use CSV to record the score and comment, and upload CSV score directly to the eeclass platform with just 2 Enter key!

Dec 11, 2021
A simple CLI use to cleanup old folder

cleanup folder A simple CLI use to cleanup old folder Building $ go build $ ./cleanup Cleanup is a CLI application to remove old folder by max number

Nov 19, 2022
A very basic cli keyring tool to use accross various OS.

A very basic cli keyring tool to use accross various OS.

Dec 14, 2022
Use Golang to achieve better console backend services

Use Golang to achieve better console backend services

Dec 7, 2021
Easy to use CLI for cryptography

EDH (Encryption, Decryption, Hashing) Utility that aims to improve efficiency of encryption, decryption and hashing by making a simple to use CLI Writ

Nov 4, 2021
Easy to use library and CLI utility to generate Go struct from CSV files.

csv2struct Easy to use library and CLI utility to generate Go struct from CSV files. As a benefit, it's fully compatible with csvutil. So, structs gen

Nov 7, 2022
Use the command to convert arbitrary formats to Go Struct (including json, toml, yaml, etc.)

go2struct-tool Use the command to convert arbitrary formats to Go Struct (including json, toml, yaml, etc.) Installation Run the following command und

Dec 16, 2021