How cheat/cheat works
cheat is a command-line tool for creating, finding, editing, and viewing plain-text cheatsheets organized in configured cheatpaths. The main workflow loads configuration, discovers sheets, then dispatches a requested operation; viewing and searching produce terminal or pager output. Other documented workflows include setup, Git-backed path updates, tag and directory listings, and dynamic shell completion. Source excerpts confirm configuration loading, sheet discovery, search, and output behavior; several command internals are represented from documented capabilities and filenames, so uncertain internal wiring is omitted.
Main entry points: main.go Command entry · load.go Discover sheets · cmd_search.go Search sheets · new.go Load configuration
Components 27
CLI workflows
- Command entry
cmd/cheat/main.go - View sheet
cmd/cheat/cmd_view.go - Edit sheet
cmd/cheat/cmd_edit.go - List sheets
cmd/cheat/cmd_list.go - Search sheets
cmd/cheat/cmd_search.go - List tags
cmd/cheat/cmd_tags.go - List directories
cmd/cheat/cmd_directories.go - Remove sheet
cmd/cheat/cmd_remove.go - Update paths
cmd/cheat/cmd_update.go - Initialize config
cmd/cheat/cmd_init.go - Show config path
cmd/cheat/cmd_conf.go
Cheatsheet catalog
- Discover sheets
internal/sheets/load.go - Parse sheet
internal/sheet/parse.go - Match sheet text
internal/sheet/search.go - Filter and organize
internal/sheets/filter.go
Configuration and paths
- Load configuration
internal/config/new.go - Validate cheatpaths
internal/cheatpath/validate.go - Setup installer
internal/installer/run.go - Git path updates
internal/repo/pull.go
Output and integrations
- Shell completions
internal/completions/generate.go - Format and display
internal/display/write.go
Other components
- CLI user
- Local files
- Configured editor
- Configured pager
- Shell
- Git remotes
Connections 39
- CLI user → Command entry: invokes
- Command entry → Load configuration: loads config
- Command entry → Setup installer: runs setup
- Command entry → Shell completions: generates
- Command entry → Validate cheatpaths: filters paths
- Command entry → View sheet: dispatches
- Command entry → Edit sheet: dispatches
- Command entry → List sheets: dispatches
- Command entry → Search sheets: dispatches
- Command entry → List tags: dispatches
- Command entry → List directories: dispatches
- Command entry → Remove sheet: dispatches
- Command entry → Update paths: dispatches
- Command entry → Initialize config: dispatches
- Command entry → Show config path: dispatches
- Load configuration → Local files: reads config and paths
- Load configuration → Validate cheatpaths: prepares paths
- Discover sheets → Local files: walks and reads
- Discover sheets → Parse sheet: parses files
- View sheet → Discover sheets: loads sheets
- Edit sheet → Discover sheets: finds sheet
- Edit sheet → Configured editor: opens sheet
- List sheets → Discover sheets: loads sheets
- List sheets → Filter and organize: filters and sorts
- List tags → Discover sheets: loads sheets
- List directories → Load configuration: uses configured paths
- Remove sheet → Local files: deletes sheet
- Update paths → Git path updates: updates repositories
- Git path updates → Git remotes: pulls from
- Search sheets → Discover sheets: loads sheets
- Search sheets → Filter and organize: filters and sorts
- Search sheets → Match sheet text: matches text
- Search sheets → Format and display: formats results
- Shell completions → Discover sheets: loads sheet names
- Shell completions → Shell: provides candidates
- Format and display → Configured pager: pipes output
- Format and display → CLI user: prints output
- Setup installer → Local files: creates config
- Initialize config → Local files: writes template