-
Notifications
You must be signed in to change notification settings - Fork 28
A Bash reimplementation of Chris Lane's cheat sheet script
License
jahendrie/cheat
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
================================================================================ cheat.sh | version 1.4 | GPL v3 (see LICENSE) | 2022-07-09 James Hendrie | hendrie.james@gmail.com ================================================================================ TOC: 1. What is this? 2. Install / Uninstall 3. How do I use it? 4. Who made it? 1. What is this? 'cheat' is a cheat-sheet script for people who are too impatient to browse the manual page for a given program. It's well-suited for those who might use a program only occasionally, and need only brief reminders on the 'important bits'; the cliff-notes version of man pages, if you will. This particular version, written as a Bash script, is a reimplementation of a Python script originally written by Chris Lane (now written in Go). The other version is the 'main' version; this is the off-shoot. 2. Install / Uninstall To install this script, as root, run 'make install' from inside the top directory to which you've downloaded/extracted the program; it should be the same directory where you found this README file. To uninstall the program, as root and from that same directory (or whichever directory contains the Makefile), run 'make uninstall'. 3. How do I use it? Using this script is straightforward enough, in the typical UNIX/Linux fashion: cheat [OPTION] FILE[S] Options: -a or --add: Add a text file to the cheat sheet directory -A: Add and compress (gzip) a text file -e or --edit: Edit a cheat sheet, using editor in $EDITOR variable -k: Grep for keyword(s) in file names -g: Grep for keyword(s) inside file text -G: Same as above, but list full paths if found -s or --link: Symlink a file instead of copying it to the cheat dir -l or --list: List all cheat sheets, without full paths -L: List all cheat sheets with full paths -h or --help: List the help --version: List version and author info -u or --update: Update the sheets using the main repo (Chris Lane's) --alt-update: Same as above, except using mine (just in case?) --old-update: Update with wget/curl, downloading from a server Examples: cheat ap: List all files with 'ap' in the filename; if there is only one result, it will be displayed cheat -k: List all available cheat sheets (in ~/.cheat) cheat -k tar: Grep for all cheat sheets with 'tar' in the filename cheat -k tar sh: Grep for sheets with 'tar' or 'sh' in filenames cheat -a foo: Add 'foo' to the cheat sheet directory cheat -a foo bar: Add both 'foo' and 'bar' to the cheat sheet dir cheat -A *.txt: Add and compress all .txt files in current dir cheat -l foo.png Create a link to foo.png in the cheat directory cheat -u Update your cheat sheets from the main repo's. There are a few useful variables for people who use this script a lot: USER_CHEATSHEETS, CHEATPATH, CHEAT_PAGER, CHEAT_IMAGE_VIEWER and CHEAT_PDF_VIEWER. USER_CHEATSHEETS is the directory in which cheat sheets are stored by default. This is set to $HOME/.local/share/cheatsheets if left unspecified by the user. CHEATPATH is similar to the PATH variable, except it's used for cheat sheets. If you're referencing cheat sheets from multiple directories, you'll want to make use of this environment variable. If this variable is not set by the user, it's populated by USER_CHEATSHEETS. If the user does set this variable, it's up to them to include every directory in which cheat sheets are kept, as USER_CHEATSHEETS is not automatically added to the CHEATPATH variable. Like the PATH variable, all paths specified here must be separated by colons. CHEAT_PAGER is the program used to view the normal cheat sheets. It's assumed to accept text from stdin ('cat' and 'less' are good options). 'cat' is used by default, unless the file has more lines than the terminal emulator you're using, in which case it opts for 'less'. CHEAT_IMAGE_VIEWER is the program which is used to display image files, and CHEAT_PDF_VIEWER is the program which will display PDFs. These variables are optional, but if you can't get the script to display images/PDFs, set them to the programs you want. 4. Who made it? This version: James Hendrie hendrie.james@gmail.com https://github.com/jahendrie https://github.com/jahendrie/cheat Main version: Chris Lane chris@chris-allen-lane.com https://github.com/chrisallenlane https://github.com/cheat/cheat
About
A Bash reimplementation of Chris Lane's cheat sheet script
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published