Skip to content
A Bash reimplementation of Chris Lane's cheat sheet script
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
doc
src
CHANGES
LICENSE
Makefile
README

README

================================================================================
    cheat.sh        |   version 1.3     |   GPL v3 (see LICENSE)    | 2018-09-18
    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.  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
        -l or --link:       Link a file instead of copying it to the cheat dir
        -L:                 List all cheat sheets with full paths
        -h or --help:       List the help
        --version:          List version and author info
        -u or --update:     Update cheat sheets (safe way)
        -U:                 Overwrite all cheat sheets with downloaded versions
        --git:              Update sheets from main (Chris Lane) repo
        --git-alt:          Update sheets from alt repo (mine)


    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


    There are a few useful variables for people who use this script a lot:
    DEFAULT_CHEAT_DIR, CHEATPATH, CHEAT_TEXT_VIEWER, CHEAT_IMAGE_VIEWER and
    CHEAT_PDF_VIEWER.

    DEFAULT_CHEAT_DIR is the directory in which cheat sheets are stored by 
    default.  This is set to $HOME/.cheat 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 DEFAULT_CHEAT_DIR.  If the user does
    set this variable, it's up to them to include every directory in which cheat
    sheets are kept, as DEFAULT_CHEAT_DIR is not automatically added to the
    CHEATPATH variable.

    CHEAT_TEXT_VIEWER 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.

    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

    Main version:   Chris Lane
                        chris@chris-allen-lane.com
                        https://github.com/chrisallenlane
You can’t perform that action at this time.