Created
March 28, 2016 07:56
-
-
Save grmwld/3d5dc4262dd3960904c1 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# explain.sh begins | |
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 | |
} | |
explain "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment