fix to go to clipboard, release workflow

This commit is contained in:
2026-06-22 23:08:44 +02:00
parent 4b21757e16
commit 39361150a5
7 changed files with 135 additions and 57 deletions
+79 -5
View File
@@ -1,15 +1,89 @@
# Cheat Sheet
A small TUI Tool which displays a pre-configured json file content in a menu and lets the user search for commands and select them. Once selected these are printed in the terminal for easy access.
A small TUI tool that displays a pre-configured set of commands in a searchable
menu. Pick one and it's copied to your system clipboard — paste it where you
need it and edit before running.
I wrote this to simplify my search for commands I use often enough to need them multiple times but not often enoigh to remember alway exactly how they are called.
I wrote this to look up commands I use often enough to need repeatedly, but not
often enough to remember exactly. Written in Go with [bubbletea](https://github.com/charmbracelet/bubbletea).
Written in go + used bubbletea for the TUI part of the application.
## Install
### Homebrew (recommended)
```bash
brew install agresdominik/repo/cheatsh
```
### From source
```bash
git clone https://github.com/agresdominik/cheat_sheet
cd cheat_sheet
make install # builds and installs to ~/.local/bin
```
Make sure `~/.local/bin` is in your `PATH` (or change `PREFIX` in the `Makefile`).
## Configuration
cheatsh ships with a maintained command list and uses it by default. It lives
next to the binary and is **replaced on `brew upgrade`**, so updating the list
in this repo and releasing is all it takes to get the new commands on your
machines:
```
<prefix>/share/cheatsh/commands.json # Homebrew, e.g. /opt/homebrew/...
~/.local/share/cheatsh/commands.json # make install
data/commands.json # running from a source checkout
```
To maintain the default list, edit `data/commands.json` and release. The format
is a map of categories to command lists:
```json
{
"git": [
{ "command": "git reset --soft HEAD~1", "desc": "Undo last commit, keep changes" }
]
}
```
### Custom list
If you'd rather keep your own list (one that survives upgrades untouched), copy
the template and pass it explicitly — `--config` always wins over the bundled
default:
```bash
cp "$(brew --prefix)/share/cheatsh/commands_template.json" ~/my-commands.json
cheatsh --config ~/my-commands.json
```
## Clipboard dependency
Copying to the clipboard needs a backend:
- **macOS** — works out of the box (`pbcopy`).
- **Linux/Wayland** — `wl-clipboard`.
- **Linux/X11** — `xsel` or `xclip`.
If no backend is found, cheatsh prints the command to stdout instead.
## Usage
Use the commands in the given makefile to run, build, test in a docker container or install the application on your device. Beforehand define your own commands.json based on the `commands_template.json` in the `data/` folder.
```bash
cheatsh # browse and select; selection is copied to clipboard
cheatsh --config FILE # use a specific config file
cheatsh --help
```
Once installed just run `cheatsh` in the terminal. If it's not found, make sure `~/.local/bin/` is in your `PATH` or change the path under the `PREFIX` variable in the `Makefile`.
In the TUI: `/` to filter, `enter` to descend / select, `b` to go back, `q` to quit.
## Development
```bash
make build # build to bin/cheatsh
make local # build and run against data/commands.json
go test ./src/...
```