Hacker News new | ask | show | jobs
by ekyo777 4676 days ago
For those like me who want to call it from their zsh, add the following to your .zshrc:

explain(){ curl -s $(echo "http://explainshell.com/explain/$1?args=${@:2}" | sed -e 's/ /+/g') | sed -n '/<pre/,/<\/pre>/p' | sed -s 's/<[^>]>//g' | sed -e 's/^ //g;s/ *$//g' | grep '.' | cat }

and call it, for example like: explain git status -s

2 comments

Ha, cute! I'll add an API soon enough to return some JSON, so command line tools could wrap it more conveniently.
Perhaps I'm missing something, but this doesn't work for me:

% explain git status -s

explain:1: no such file or directory: http://explainshell.com/explain/git?args=status

curl: no URL specified!

sed: -e expression #1, char 11: unterminated `s' command

It's probably hn's formatting. I just tried copy/pasting from my post and I get the same error.

Try copying it from there: https://gist.github.com/ekyo/6383547

I can't edit my previous post anymore, if someone can maybe add something like "EDIT: copy/paste friendly version https://gist.github.com/ekyo/6383547" or better, fix the formatting so it works...