Last active
February 21, 2019 02:55
-
-
Save droctothorpe/6aa2f0783c3c3f5c3375b0bf2be102a1 to your computer and use it in GitHub Desktop.
explain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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