A (terminal) cheat sheet utility
https://github.com/gimbo/cheeto.git
This is cheeto, a simple cheat sheet utility (written in python) which looks in some known folder for textual cheat sheets and writes their contents to the terminal, rendering markdown if found.
uv rules the roost! Either:
uv tool install git+https://github.com/gimbo/cheeto
or to just run it once:
uvx --from git+https://github.com/gimbo/cheeto cheeto
uv?pipx is recommended:
pipx install <path to this folder>
should work; check it with:
$ cheeto --version
cheeto version 1.0.0
To install zsh completions for the cheeto command, install this repo as a zsh plugin using your plugin manager of choice. Note that this does not install the cheeto command itself: just its completions.
cheeto looks for cheat sheets (which are just files whose name contains the text cheatsheet) in a single folder and its children, recursively; that root is specified as follows:
--path/-p command line argument if set.CHEETO_DATA_PATH env var if set (here, ~ will be expanded).cheeto in XDG_DATA_HOME.cheeto --help will show you the current status, e.g.:
$ cheeto --help
-p PATH, --path PATH Path to est-cli config; default is contents of
CHEETO_DATA_PATH env var if set (now:
~/.config/cheeto/sheets); otherwise
~/Library/Application Support/cheeto
(in this example ~/Library/Application is the value of XDG_DATA_HOME โ the default on macOS).
cheeto ls [--plain | --table | --json]
--plain โ just the sheet names (see below), one per line.--table โ a table containing more detailed information on each sheet.--json โ sheet detail (like --table) but in JSON format..cheatsheet if that's the last text before the suffix; e.g. a cheatsheet in the file foo.cheatsheet.md will have name foo. However, if two cheat sheets with the same name are discovered in different paths, each one's shortest distinct path prefix (with respect to the others of the same name) is added to the name; e.g. if we have foo/bar/baz.cheatsheet.md and foo/gar/baz.cheatsheet.md their names will be bar/baz and gar/baz respectively. If names still clash even after such a transformation (e.g. if you have foo/bar/baz.cheetsheet.md and foo/bar/baz.cheatsheet) then cheeto will complain and exit.
cheeto show <sheet_name>
This loads the sheet (specified using its name as shown by cheeto ls) and writes its contents to the terminal.
cheeto will try to determine if the sheet is in markdown format; it uses a simple heuristic: it's considered markdown if the sheet's filename ends in .md or if the sheet's first line looks like a markdown level-1 header in # format โ e.g. # <blah.
Then, the markdown is rendered using one of a number of available renderers, controlled using the --markdown-renderer / -m option; these may be extended (see below) but by default the options are:
rich โ (the default) use the rich python package to render the markdown.null โ render the markdown as plain text.mdcat โ use the mdcat tool.glow โ use the glow tool (in dark mode).glowl โ use the glow tool (in light mode).mdcat and glow/glowl options will only appear if those tools appear to be in the $PATH.
This list may be extended without modifying this package's code, via python's entry points machinery: implement a subclass of the ABC cheeto.utils.markdown.MarkdownRenderer and register it with the cheeto.utils.markdown.renderers entry point.
This is inspired by the 0b10/cheatsheet zsh plugin. I tried that for a while but realised it didn't quite fit my needs:
# as comments โ so no markdown headings!pip install -U pip setuptoolspip install -e ".[dev]"pre-commit install --install-hooksUse bump2version; e.g.:
bumpversion patch --verbose