Download the CLI

snip posts a snippet from a shell and prints its URL. It is a single static binary with no runtime to install, and it needs nothing but this site's address and a token.

cat notes.md | snip                  # public, prints the URL
snip -p secrets.txt                  # private
snip -t "the two halves" a.go b.go   # one snippet, two files

Get a build

Every release is published on the tags page. Open the newest tag and take the archive for your machine.

VERSION is the tag you are downloading, so the macOS Apple-silicon archive for v1.2.0 is snip-v1.2.0-darwin-arm64.tar.gz. Each release also carries a SHA256SUMS file; sha256sum -c SHA256SUMS checks what you got against it.

Unpack it and put the binary somewhere on your PATH:

tar -xzf snip-v1.2.0-darwin-arm64.tar.gz
sudo mv snip-v1.2.0-darwin-arm64/snip /usr/local/bin/

Or build it yourself

With a Go toolchain, nothing above is necessary — and this route skips the signing problem entirely, because you compiled it:

GOPROXY=direct go install snippets.stahnma.us/cmd/snip@latest

That puts snip in $(go env GOPATH)/bin. GOPROXY=direct fetches from the repository rather than through the Go module proxy, which cannot fetch this module from its git host at the moment. The source also builds it with make cli.

Point it at this site

Run snip setup. It asks for the server URL and a token, and writes them to ~/.config/snippets with the token chmod 600.

You will need a token, which means an account: sign in, then create one under API tokens in your settings. It is shown once, because only a hash of it is stored here.

Prefer not to have it written down? SNIPPETS_URL and SNIPPETS_TOKEN in the environment do the same job, and win over the files.