Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active September 16, 2024 14:44
Show Gist options
  • Save MichaelDimmitt/2bb02d435a0ddbe2509a4cfef0fdfbe1 to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/2bb02d435a0ddbe2509a4cfef0fdfbe1 to your computer and use it in GitHub Desktop.
Find the correct help function on command line.
function hhelp() {
help $1 > /dev/null 2>&1 && echo "yes, help $1" || echo "no, help $1" ;
man $1 > /dev/null 2>&1 && echo "yes, man $1" || echo "no, man $1";
$1 --help > /dev/null 2>&1 && echo "yes, $1 --help" || echo "no, $1 --help";
$1 -h > /dev/null 2>&1 && echo "yes, $1 -h" || echo "no, $1 -h";
apropos $1 > /dev/null 2>&1 && echo "yes, apropos $1" || echo "no, apropos $1";
whatis $1 > /dev/null 2>&1 && echo "yes, whatis $1" || echo "no, whatis $1";
which $1 > /dev/null 2>&1 && echo "yes, which $1" || echo "no, which $1";
}
# because sometimes it is hard to find the correct help function on command line.
@MichaelDimmitt
Copy link
Author

add tldr + a check to see if tldr exists before showing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment