url

HTTP on demand
in your shell

url downloads an HTTP resource to a disk cache and prints its local path. run does that, then executes it.

sh
~ ❯ url https://omarchy.org/brand/omarchy-wordmark.svg
/home/mike/.cache/dev.hydraulic/url-tool/cache/entries/af/2c/af2c4969d14f020b/content/omarchy-wordmark.svg

~ ❯ chafa `url https://omarchy.org/brand/omarchy-wordmark.svg`
Omarchy wordmark

HTTP's caching protocol is used; run it again and the result comes back fast. If the resource has changed it's refreshed.

Link inside archives

Treat zips and tarballs like directories. The archive is downloaded and extracted to the disk cache, and the path is printed.

$ ls `url downloads.hydraulic.dev/conveyor/conveyor-22.2-linux-amd64.tar.gz/lib`
app   runtime

Execute URLs directly

run appends /run.zip/run.pkl, resolves the package's URLs, then executes its launch plan.

sh

$ run https://hydraulic-software.github.io/url/ hello
Hello from run.zip.
argument: hello
inspect the package ↗

On zsh just use an HTTPS URL as a command directly.

zsh

$ https://hydraulic-software.github.io/url/ hello
Hello from run.zip.
argument: hello

The run.pkl file detects the running OS and produces the right launch plan.

Pin the server down

Add a SHA-256 fragment to lock expected content.

sh

$ url example.com/tool#sha256=e9e433…602712
…/content/tool
$ url example.com/tool#sha256=e9e433…ffffff
url: SHA-256 mismatch: expected e9e433…ffffff but resolved e9e433…602712

Resolve in bulk

Multiple URLs are downloaded in parallel. Comments and blank lines are ignored, so the input doubles as a small lockfile.

sh

$ url <<'EOF'
# pinned inputs
https://a.example/a#sha256=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

# another pinned input
https://b.example/b#sha256=abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789
EOF
…/content/a
…/content/b

Watch a download

Use --progress=bar for an animated Unicode progress bar while url downloads.

sh · asciicast

Reimplementable

Don't like the reference implementation? No problem.

Give the specification to your favourite model and make a better one.