Skip to content

vrypan/stash

Repository files navigation

social-banner

~{@ stash

stash is a small local store for pipeline output and ad hoc file snapshots.

It stores each entry as raw bytes under ~/.stash/data, stores attributes under ~/.stash/attr, assigns it a stable ULID, and lets you retrieve entries by recency or ID later. Everything is flat files and directories.

Without a subcommand, stash uses smart mode:

  • in the middle of a pipeline, it behaves like stash tee
  • otherwise, it behaves like stash push

Tip

stash fits nicely in any workflow that would involve temporary files, or expensive output that needs to be processed in more than one ways.

Note

What is ~{@??? An ASCII art acorn.

Quick Start

Save output and reuse it:

curl -s https://api.example.com/data | stash
stash cat | jq .
stash cat | jq '.items[]'

Keep the pipeline flowing while saving the same bytes:

curl -s https://api.example.com/data | stash tee | jq .
curl -s https://api.example.com/data | stash | jq .

By default, stash, stash push, and stash tee do not print the generated entry ID. Use --print=stdout, --print=stderr, or --print=null to control where the ID is emitted.

Use with diff:

find . -type f | sort | stash -a label=before
# ... later ...
find . -type f | sort | stash -a label=after

diff -u <(stash cat @2) <(stash cat @1)

File-oriented view:

stash ls
stash log
stash attr @1

Installation

From Source

Build the Rust binary and copy it to a location in your PATH:

cargo build --release
cp target/release/stash /usr/local/bin/stash

With Cargo

cargo install stash-cli

Pre-built binaries

Available under releases.

Homebrew

brew install vrypan/tap/stash

Shell support

For auto-completion and other shell-specific features, check:

Stash Repository Location

By default, stash stores data under ~/.stash.

You can override the stash root with STASH_DIR:

STASH_DIR=/tmp/job-a stash log
STASH_DIR=/tmp/job-a stash Makefile
STASH_DIR=/tmp/job-b stash log

This is useful when you want separate independent stashes for different jobs, projects, or CI runs.

Documentation

About

stash is a small local store for pipeline output and ad hoc file snapshots.

Resources

License

Stars

Watchers

Forks

Packages