Skip to content
This repository has been archived by the owner on Oct 20, 2019. It is now read-only.
/ go-cheat Public archive

A Go implementation of Chris Allen's Python tool for sysadmins

License

Notifications You must be signed in to change notification settings

m3nu/go-cheat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-cheat (depreceated)

The original cheat was rewritten in Go and has many more features than this projects. Recommend to use that. See also this issue or the main project page

go-cheat allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.

go-cheat is a Go implementation of Chris Allen Lane's great cheat Python package. It aims to be fully compatible with the Python version and solves those issues:

  • Many users don't maintain a Python installation and pip is often not available. go-cheat comes as a single binary for most architectures. See releases.
  • cheat tries to install system-wide cheat sheets and [fails(cheat/cheat#431)] without root permissions. go-cheat includes a default set of cheat sheets from cheat in the binary.

Todo:

  • Tests
  • Nicer release script and more architectures

Example

The next time you're forced to disarm a nuclear weapon without consulting Google, you may run:

cheat tar

You will be presented with a cheatsheet resembling:

# To extract an uncompressed archive: 
tar -xvf '/path/to/foo.tar'

# To extract a .gz archive:
tar -xzvf '/path/to/foo.tgz'

# To create a .gz archive:
tar -czvf '/path/to/foo.tgz' '/path/to/foo/'

# To extract a .bz2 archive:
tar -xjvf '/path/to/foo.tgz'

# To create a .bz2 archive:
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'

To see what cheatsheets are available, run cheat -l.

Note that, while cheat was designed primarily for *nix system administrators, it is agnostic as to what content it stores. If you would like to use cheat to store notes on your favorite cookie recipes, feel free.

Installing

Download the binary release or package (rpm/deb) for your platform from Releases.

To install the .deb: $ apt install ./cheat-*.deb

Or the .rpm: $ yum localinstall ./cheat-*.rpm

Modifying Cheatsheets

The value of cheat is that it allows you to create your own cheatsheets - the defaults are meant to serve only as a starting point, and can and should be modified.

Cheatsheets are stored in the ~/.cheat/ directory, and are named on a per-keyphrase basis. In other words, the content for the tar cheatsheet lives in the ~/.cheat/tar file.

Configuring

Setting a CHEAT_USER_DIR

Personal cheatsheets are saved in the ~/.cheat directory by default, but you can specify a different default by exporting a CHEAT_USER_DIR environment variable:

export CHEAT_USER_DIR='/path/to/my/cheats'

Setting a CHEAT_PATH

You can additionally instruct cheat to look for cheatsheets in other directories by exporting a CHEAT_PATH environment variable:

export CHEAT_PATH='/path/to/my/cheats'

You may, of course, append multiple directories to your CHEAT_PATH:

export CHEAT_PATH="$CHEAT_PATH:/path/to/more/cheats"

You may view which directories are on your CHEAT_PATH with cheat -d.

Enabling Syntax Highlighting

cheat can optionally apply syntax highlighting to your cheatsheets. To enable syntax highlighting, export a CHEAT_COLORS environment variable:

export CHEAT_COLORS=true

cheat ships with both light and dark colorschemes to support terminals with different background colors. A colorscheme may be selected via the CHEAT_COLORSCHEME envvar. Valid values can be found here:

export CHEAT_COLORSCHEME=pygments

See Also:

About

A Go implementation of Chris Allen's Python tool for sysadmins

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published