Skip to content

Instantly share code, notes, and snippets.

@droctothorpe
Last active February 21, 2019 02:55
Show Gist options
  • Save droctothorpe/6aa2f0783c3c3f5c3375b0bf2be102a1 to your computer and use it in GitHub Desktop.
Save droctothorpe/6aa2f0783c3c3f5c3375b0bf2be102a1 to your computer and use it in GitHub Desktop.
explain
explain () {
if [ "$#" -eq 0 ]
then
while read -p "Command: " cmd
do
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
done
echo "Bye!"
elif [ "$#" -eq 1 ]
then
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1"
else
echo "Usage"
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment