feat: add --update/-u flag to pull git-backed cheatpaths (#552)

Iterates over configured cheatpaths and runs git pull on each one that
is a git repository with a clean worktree. Supports SSH remotes via key
file discovery and SSH agent fallback. Works with --path filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Allen Lane
2026-02-15 19:40:07 -05:00
parent 417b5b4e42
commit 80e0e0d3ae
11 changed files with 535 additions and 16 deletions

View File

@@ -53,6 +53,9 @@ Filter only to sheets tagged with \f[I]TAG\f[R].
\-T, \[en]tags
List all tags in use.
.TP
\-u, \[en]update
Update git\-backed cheatpaths by pulling the latest changes.
.TP
\-v, \[en]version
Print the version number.
.TP
@@ -98,23 +101,31 @@ cheat \-c \-r \-s \f[I]`(?:[0\-9]{1,3}.){3}[0\-9]{1,3}'\f[R]
To remove (delete) the foo/bar cheatsheet:
cheat \[en]rm \f[I]foo/bar\f[R]
.TP
To update all git\-backed cheatpaths:
cheat \[en]update
.TP
To update only the `community' cheatpath:
cheat \-u \-p \f[I]community\f[R]
.TP
To view the configuration file path:
cheat \[en]conf
.SH FILES
.SS Configuration
\f[B]cheat\f[R] is configured via a YAML file that is conventionally
named \f[I]conf.yaml\f[R].
\f[B]cheat\f[R] will search for \f[I]conf.yaml\f[R] in varying
locations, depending upon your platform:
named \f[I]conf.yml\f[R].
\f[B]cheat\f[R] will search for \f[I]conf.yml\f[R] in varying locations,
depending upon your platform:
.SS Linux, OSX, and other Unixes
.IP "1." 3
\f[B]CHEAT_CONFIG_PATH\f[R]
.IP "2." 3
\f[B]XDG_CONFIG_HOME\f[R]/cheat/conf.yaml
\f[B]XDG_CONFIG_HOME\f[R]/cheat/conf.yml
.IP "3." 3
\f[B]$HOME\f[R]/.config/cheat/conf.yml
.IP "4." 3
\f[B]$HOME\f[R]/.cheat/conf.yml
.IP "5." 3
/etc/cheat/conf.yml
.SS Windows
.IP "1." 3
\f[B]CHEAT_CONFIG_PATH\f[R]
@@ -124,7 +135,7 @@ locations, depending upon your platform:
\f[B]PROGRAMDATA\f[R]/cheat/conf.yml
.PP
\f[B]cheat\f[R] will search in the order specified above.
The first \f[I]conf.yaml\f[R] encountered will be respected.
The first \f[I]conf.yml\f[R] encountered will be respected.
.PP
If \f[B]cheat\f[R] cannot locate a config file, it will ask if you\[cq]d
like to generate one automatically.
@@ -134,7 +145,7 @@ location for your platform.
.SS Cheatpaths
\f[B]cheat\f[R] reads its cheatsheets from \[lq]cheatpaths\[rq], which
are the directories in which cheatsheets are stored.
Cheatpaths may be configured in \f[I]conf.yaml\f[R], and viewed via
Cheatpaths may be configured in \f[I]conf.yml\f[R], and viewed via
\f[B]cheat \-d\f[R].
.PP
For detailed instructions on how to configure cheatpaths, please refer

View File

@@ -59,6 +59,9 @@ OPTIONS
-T, --tags
: List all tags in use.
-u, --update
: Update git-backed cheatpaths by pulling the latest changes.
-v, --version
: Print the version number.
@@ -106,6 +109,12 @@ To search (by regex) for cheatsheets that contain an IP address:
To remove (delete) the foo/bar cheatsheet:
: cheat --rm _foo/bar_
To update all git-backed cheatpaths:
: cheat --update
To update only the 'community' cheatpath:
: cheat -u -p _community_
To view the configuration file path:
: cheat --conf
@@ -116,15 +125,16 @@ FILES
Configuration
-------------
**cheat** is configured via a YAML file that is conventionally named
_conf.yaml_. **cheat** will search for _conf.yaml_ in varying locations,
_conf.yml_. **cheat** will search for _conf.yml_ in varying locations,
depending upon your platform:
### Linux, OSX, and other Unixes ###
1. **CHEAT_CONFIG_PATH**
2. **XDG_CONFIG_HOME**/cheat/conf.yaml
2. **XDG_CONFIG_HOME**/cheat/conf.yml
3. **$HOME**/.config/cheat/conf.yml
4. **$HOME**/.cheat/conf.yml
5. /etc/cheat/conf.yml
### Windows ###
@@ -132,7 +142,7 @@ depending upon your platform:
2. **APPDATA**/cheat/conf.yml
3. **PROGRAMDATA**/cheat/conf.yml
**cheat** will search in the order specified above. The first _conf.yaml_
**cheat** will search in the order specified above. The first _conf.yml_
encountered will be respected.
If **cheat** cannot locate a config file, it will ask if you'd like to generate
@@ -144,7 +154,7 @@ for your platform.
Cheatpaths
----------
**cheat** reads its cheatsheets from "cheatpaths", which are the directories in
which cheatsheets are stored. Cheatpaths may be configured in _conf.yaml_, and
which cheatsheets are stored. Cheatpaths may be configured in _conf.yml_, and
viewed via **cheat -d**.
For detailed instructions on how to configure cheatpaths, please refer to the