Command line interface url

Posted 2023-02-05 23:25. Tagged , , .

I wrote a little command-line interface for sending a http request and getting the response. I call the package url-cli, and the command itself is url. It has sub-commands for the different http methods.

If you have a rust toolchain installed, you can get it by cargo install. I haven’t made any binary packages yet.

:; cargo install url-cli
[... building, installing ...]
:; url get https://rasmus.krats.se/2023/url-cli.en
<!doctype html>
[... and all the rest of the html for this web page ...]

Yes, I know that curl exists and is generally great, along with lots of others, like wget, fetch, etc. Still, last Thursday I got a bit annoyed at the existing commands and decided to roll my own small cli around the excellent rust http crate reqwest.

This tool is still young, initial version is just released, but the release notes show that it supports pretty much all I need at the moment:

There is no code involved for paging or formatting the body, it is just written as-is to standard output. Pipe it to bat for code highlighting and paging, to jq for json querying and formatting, cli-selector for getting elements (or their contents or attributes) identified by css selectors, or your favorite tools for the format you’re working with.

The code is on https://codeberg.org/rkaj/url-cli. Go there and take a look at the code, report an issue if something is missing. Maybe even write some changes and submit a pull request?

Wait, what? Codeberg?

Yes. Lots of my code are on github. Probably lots of yours too, if you write code. I find it rather ironic that nearly all open source code are hosted on a single closed-source service provided by one single company.

So when I heard about Codeberg about a month ago, I decided I should try it out. The service is provided by Codeberg e.V, a registered non-profit association based in Berlin, Germany. It is possible to join the association to support it, but the service is free and open to non-members as well as members.

The service itself is the forgejo (which used to be known as gitea until gitea was incorporated as a for-profit company).


codeberg was new. I have some (and hosted some instance at aj ti em) gitlab; Any thoughs wich is better?

Signed, P1ersson
2023-02-17 13:42

P1ersson, as for technical merits, I haven't really used either enough to know yet. Gitlab has been around longer, so possibly it has better integrations to some things? Some large open source projects (e.g. gnome) uses their own gitlab instance, so I use that from time to time as well. What I like about Codeberg is mainly the organisation form, that it is a non-profit in Europe.

Signed, Rasmus Kaj
2023-02-19 13:09

Write a comment

Basic markdown is accepted.

Your name (or pseudonym).

Not published, except as gravatar.

Your presentation / homepage (if any).