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.
-
macOS — Apple silicon
M1 and later
snip-VERSION-darwin-arm64.tar.gz -
macOS — Intel
snip-VERSION-darwin-amd64.tar.gz -
Linux — x86-64
snip-VERSION-linux-amd64.tar.gz -
Linux — ARM64
Raspberry Pi, Graviton
snip-VERSION-linux-arm64.tar.gz -
Windows — x86-64
snip-VERSION-windows-amd64.zip -
Windows — ARM64
snip-VERSION-windows-arm64.zip
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.