Skip to content

Instantly share code, notes, and snippets.

@umi-uyura
Created February 9, 2016 11:37
Show Gist options
  • Save umi-uyura/91bb374c86050562f20b to your computer and use it in GitHub Desktop.
Save umi-uyura/91bb374c86050562f20b to your computer and use it in GitHub Desktop.
Display cheat sheet for command using 'cheat' and 'tldr'
#!/bin/sh
#
# How - cheat and tldr
#
function usage()
{
cat << EOF
Display cheat sheet for command using 'cheat' and 'tldr'
Usage :
$CMDNAME <command>
$CMDNAME -h
Options :
-h show usage
'cheat' and 'tldr' command of detail
cheat -h
tldr -h
EOF
}
### Main Logic
CMDNAME=`basename $0`
KEYWORD=$1
while getopts h OPT
do
case $OPT in
h) usage
exit 1
;;
\?) usage
exit 1
;;
esac
done
if [ "" = "$KEYWORD" ]; then
usage
exit 1
fi
echo "======================================= cheat"
cheat $KEYWORD
echo "======================================== tldr"
tldr $KEYWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment