Skip to content
/ stash Public

A terminal UI for managing shell snippets. Save, search, and execute your frequently used commands.

Notifications You must be signed in to change notification settings

dnlvgl/stash

Repository files navigation

stash

A terminal UI for managing shell snippets. Save, search, and execute your frequently used commands.

stash screenshot

Features

  • Browse and search snippets with fuzzy filtering
  • Copy commands to clipboard or execute directly
  • Usage tracking (sorts by most used)
  • Hand-editable YAML storage
  • Minimal, keyboard-driven interface

Installation

go install github.com/user/stash@latest

Or build from source:

git clone https://github.com/user/stash
cd stash
go build -o stash .

Usage

Launch the TUI:

stash

Add a snippet from the command line:

stash add "docker exec -it container bash"

This opens the TUI with the command pre-filled so you can add a description and tags.

Key Bindings

Key Action
j / k / / Navigate list
Enter Copy snippet to clipboard
x Execute snippet
a Add new snippet
e Edit selected snippet
d Delete (with confirmation)
/ Search / filter
Esc Clear filter / cancel
? Toggle help
q Quit

Storage

Snippets are stored in ~/.config/stash/snippets.yaml. The file is human-readable and can be edited directly:

snippets:
  - command: "docker ps -a"
    description: "List all containers"
    tags:
      - docker

Only command is required. All other fields are optional and will be auto-populated:

snippets:
  - command: "git status"
  - command: "docker ps"
    description: "List running containers"

See snippets.example.yaml for more examples.

Testing

Run all tests:

go test ./... -v

Run tests with race detection:

go test ./... -v -race

Run tests for a specific package:

go test ./internal/storage/... -v

Test Coverage

Package What's tested
internal/model Snippet creation, defaults, usage tracking, YAML serialization
internal/storage Load/save, add/update/delete, bounds checks, round-trips, edge cases
internal/config XDG path resolution, directory creation, idempotency
internal/tui Mode transitions, list filtering & navigation, form input & submission, detail/confirm/help rendering, key bindings, styles
cmd Shell execution, CLI argument validation, subcommand registration

CI

A GitHub Actions workflow runs on every push and pull request:

  • Test — builds the project and runs all tests with -race
  • Lint — checks gofmt formatting and go vet

Dependencies

About

A terminal UI for managing shell snippets. Save, search, and execute your frequently used commands.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages