mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 03:03:32 +01:00
Replace docopt-go with spf13/cobra, giving cheat a built-in `--completion` flag that dynamically generates shell completions for bash, zsh, fish, and powershell. This replaces the manually-maintained static completion scripts and resolves the root cause of multiple completion issues (#768, #705, #633, #632, #476). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
206 lines
5.2 KiB
Groff
206 lines
5.2 KiB
Groff
.\" Automatically generated by Pandoc 3.1.11.1
|
|
.\"
|
|
.TH "CHEAT" "1" "" "" "General Commands Manual"
|
|
.SH NAME
|
|
\f[B]cheat\f[R] \[em] create and view command\-line cheatsheets
|
|
.SH SYNOPSIS
|
|
.PP
|
|
\f[B]cheat\f[R] [options] [\f[I]CHEATSHEET\f[R]]
|
|
.SH DESCRIPTION
|
|
\f[B]cheat\f[R] 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.
|
|
.SH OPTIONS
|
|
.TP
|
|
\[en]init
|
|
Print a config file to stdout.
|
|
.TP
|
|
\[en]conf
|
|
Display the config file path.
|
|
.TP
|
|
\-a, \[en]all
|
|
Search among all cheatpaths.
|
|
.TP
|
|
\-b, \[en]brief
|
|
List cheatsheets without file paths.
|
|
.TP
|
|
\-c, \[en]colorize
|
|
Colorize output.
|
|
.TP
|
|
\-d, \[en]directories
|
|
List cheatsheet directories.
|
|
.TP
|
|
\-e, \[en]edit=\f[I]CHEATSHEET\f[R]
|
|
Open \f[I]CHEATSHEET\f[R] for editing.
|
|
.TP
|
|
\-l, \[en]list
|
|
List available cheatsheets.
|
|
.TP
|
|
\-p, \[en]path=\f[I]PATH\f[R]
|
|
Filter only to sheets found on path \f[I]PATH\f[R].
|
|
.TP
|
|
\-r, \[en]regex
|
|
Treat search \f[I]PHRASE\f[R] as a regular expression.
|
|
.TP
|
|
\-s, \[en]search=\f[I]PHRASE\f[R]
|
|
Search cheatsheets for \f[I]PHRASE\f[R].
|
|
.TP
|
|
\-t, \[en]tag=\f[I]TAG\f[R]
|
|
Filter only to sheets tagged with \f[I]TAG\f[R].
|
|
.TP
|
|
\-T, \[en]tags
|
|
List all tags in use.
|
|
.TP
|
|
\-v, \[en]version
|
|
Print the version number.
|
|
.TP
|
|
\[en]rm=\f[I]CHEATSHEET\f[R]
|
|
Remove (deletes) \f[I]CHEATSHEET\f[R].
|
|
.TP
|
|
\[en]completion=\f[I]SHELL\f[R]
|
|
Generate a shell completion script.
|
|
\f[I]SHELL\f[R] must be one of: \f[B]bash\f[R], \f[B]zsh\f[R],
|
|
\f[B]fish\f[R], \f[B]powershell\f[R].
|
|
.SH EXAMPLES
|
|
.TP
|
|
To view the foo cheatsheet:
|
|
cheat \f[I]foo\f[R]
|
|
.TP
|
|
To edit (or create) the foo cheatsheet:
|
|
cheat \-e \f[I]foo\f[R]
|
|
.TP
|
|
To edit (or create) the foo/bar cheatsheet on the `work' cheatpath:
|
|
cheat \-p \f[I]work\f[R] \-e \f[I]foo/bar\f[R]
|
|
.TP
|
|
To view all cheatsheet directories:
|
|
cheat \-d
|
|
.TP
|
|
To list all available cheatsheets:
|
|
cheat \-l
|
|
.TP
|
|
To briefly list all cheatsheets whose titles match `apt':
|
|
cheat \-b \f[I]apt\f[R]
|
|
.TP
|
|
To list all tags in use:
|
|
cheat \-T
|
|
.TP
|
|
To list available cheatsheets that are tagged as `personal':
|
|
cheat \-l \-t \f[I]personal\f[R]
|
|
.TP
|
|
To search for `ssh' among all cheatsheets, and colorize matches:
|
|
cheat \-c \-s \f[I]ssh\f[R]
|
|
.TP
|
|
To search (by regex) for cheatsheets that contain an IP address:
|
|
cheat \-c \-r \-s \f[I]`(?:[0\-9]{1,3}.){3}[0\-9]{1,3}'\f[R]
|
|
.TP
|
|
To remove (delete) the foo/bar cheatsheet:
|
|
cheat \[en]rm \f[I]foo/bar\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:
|
|
.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
|
|
.IP "3." 3
|
|
\f[B]$HOME\f[R]/.config/cheat/conf.yml
|
|
.IP "4." 3
|
|
\f[B]$HOME\f[R]/.cheat/conf.yml
|
|
.SS Windows
|
|
.IP "1." 3
|
|
\f[B]CHEAT_CONFIG_PATH\f[R]
|
|
.IP "2." 3
|
|
\f[B]APPDATA\f[R]/cheat/conf.yml
|
|
.IP "3." 3
|
|
\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.
|
|
.PP
|
|
If \f[B]cheat\f[R] cannot locate a config file, it will ask if you\[cq]d
|
|
like to generate one automatically.
|
|
Alternatively, you may also generate a config file manually by running
|
|
\f[B]cheat \[en]init\f[R] and saving its output to the appropriate
|
|
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
|
|
\f[B]cheat \-d\f[R].
|
|
.PP
|
|
For detailed instructions on how to configure cheatpaths, please refer
|
|
to the comments in conf.yml.
|
|
.SS Autocompletion
|
|
\f[B]cheat\f[R] can generate shell completion scripts for
|
|
\f[B]bash\f[R], \f[B]zsh\f[R], \f[B]fish\f[R], and \f[B]powershell\f[R]
|
|
via the \f[B]\[en]completion\f[R] flag:
|
|
.IP
|
|
.EX
|
|
cheat \-\-completion bash
|
|
cheat \-\-completion zsh
|
|
cheat \-\-completion fish
|
|
cheat \-\-completion powershell
|
|
.EE
|
|
.PP
|
|
Completions are dynamically generated and include cheatsheet names,
|
|
tags, and cheatpath names.
|
|
.PP
|
|
To install completions, pipe the output to the appropriate location for
|
|
your shell.
|
|
For example, on \f[B]bash\f[R]:
|
|
.IP
|
|
.EX
|
|
cheat \-\-completion bash > /etc/bash_completion.d/cheat
|
|
.EE
|
|
.PP
|
|
Or for the current user only:
|
|
.IP
|
|
.EX
|
|
cheat \-\-completion bash > \[ti]/.local/share/bash\-completion/completions/cheat
|
|
.EE
|
|
.PP
|
|
For \f[B]zsh\f[R], you may need to add the completions directory to your
|
|
\f[B]fpath\f[R]:
|
|
.IP
|
|
.EX
|
|
cheat \-\-completion zsh > \[dq]${fpath[1]}/_cheat\[dq]
|
|
.EE
|
|
.PP
|
|
For \f[B]fish\f[R]:
|
|
.IP
|
|
.EX
|
|
cheat \-\-completion fish > \[ti]/.config/fish/completions/cheat.fish
|
|
.EE
|
|
.SH ENVIRONMENT
|
|
.TP
|
|
\f[B]CHEAT_CONFIG_PATH\f[R]
|
|
The path at which the config file is available.
|
|
If \f[B]CHEAT_CONFIG_PATH\f[R] is set, all other config paths will be
|
|
ignored.
|
|
.SH RETURN VALUES
|
|
.IP "0." 3
|
|
Successful termination
|
|
.IP "1." 3
|
|
Application error
|
|
.IP "2." 3
|
|
Cheatsheet(s) not found
|
|
.SH BUGS
|
|
See GitHub issues: \c
|
|
.UR https://github.com/cheat/cheat/issues
|
|
.UE \c
|
|
.SH AUTHOR
|
|
Christopher Allen Lane \c
|
|
.MT chris@chris-allen-lane.com
|
|
.ME \c
|
|
.SH SEE ALSO
|
|
\f[B]fzf(1)\f[R]
|