// To map over an array: const squares = [1, 2, 3, 4].map(x => x * x);
The `cheat` executable includes no cheatsheets, but [community-sourced
cheatsheets are available][cheatsheets]. You will be asked if you would like to
install the community-sourced cheatsheets the first time you run `cheat`.
### Cheatpaths
Cheatsheets are stored on "cheatpaths", which are directories that contain
cheetsheets. Cheatpaths are specified in the `conf.yml` file.
It can be useful to configure `cheat` against multiple cheatpaths. A common
pattern is to store cheatsheets from multiple repositories on individual
cheatpaths:
```yaml
# conf.yml:
# ...
cheatpaths:
- name: community # a name for the cheatpath
path: ~/documents/cheat/community # the path's location on the filesystem
tags: [ community ] # these tags will be applied to all sheets on the path
readonly: true # if true, `cheat` will not create new cheatsheets here
- name: personal
path: ~/documents/cheat/personal # this is a separate directory and repository than above
tags: [ personal ]
readonly: false # new sheets may be written here
# ...
The readonly option instructs cheat not to edit (or create) any cheatsheets
on the path. This is useful to prevent merge-conflicts from arising on upstream
cheatsheet repositories.
If a user attempts to edit a cheatsheet on a read-only cheatpath, cheat will
transparently copy that sheet to a writeable directory before opening it for
editing.
Directory-scoped Cheatpaths
At times, it can be useful to closely associate cheatsheets with a directory on
your filesystem. cheat facilitates this by searching for a .cheat folder in
the current working directory. If found, the .cheat directory will
(temporarily) be added to the cheatpaths.
Usage
To view a cheatsheet:
cheat tar # a "top-level" cheatsheet
cheat foo/bar # a "nested" cheatsheet
To edit a cheatsheet:
cheat -e tar # opens the "tar" cheatsheet for editing, or creates it if it does not exist
cheat -e foo/bar # nested cheatsheets are accessed like this
To view the configured cheatpaths:
cheat -d
To list all available cheatsheets:
cheat -l
To list all cheatsheets that are tagged with "networking":
cheat -l -t networking
To list all cheatsheets on the "personal" path:
cheat -l -p personal
To search for the phrase "ssh" among cheatsheets:
cheat -s ssh
To search (by regex) for cheatsheets that contain an IP address:
cheat -r -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'
Flags may be combined in intuitive ways. Example: to search sheets on the "personal" cheatpath that are tagged with "networking" and match a regex:
cheat -p personal -t networking --regex -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'
Advanced Usage
Shell autocompletion is currently available for bash, fish, and zsh. Copy
the relevant completion script into the appropriate directory on
your filesystem to enable autocompletion. (This directory will vary depending
on operating system and shell specifics.)
Additionally, cheat supports enhanced autocompletion via integration with
fzf. To enable fzf integration:
- Ensure that
fzfis available on your$PATH - Set an envvar:
export CHEAT_USE_FZF=true
- public document at doc.anagora.org/cheat
- video call at meet.jit.si/cheat