From 43dcef1b07a17954af404fd155114eef26aa2695 Mon Sep 17 00:00:00 2001 From: tinogomes Date: Wed, 2 Oct 2013 15:55:57 -0300 Subject: [PATCH] New plugin: Explain Shell --- plugins/explainshell/explainshell.plugin.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/explainshell/explainshell.plugin.zsh diff --git a/plugins/explainshell/explainshell.plugin.zsh b/plugins/explainshell/explainshell.plugin.zsh new file mode 100644 index 000000000..df30fadce --- /dev/null +++ b/plugins/explainshell/explainshell.plugin.zsh @@ -0,0 +1,17 @@ +function explain { + # base url with first command already injected + # $ explain tar + # => http://explainshel.com/explain/tar?args= + url="http://explainshell.com/explain/$1?args=" + + # removes $1 (tar) from arguments ($@) + shift; + + # iterates over remaining args and adds builds the rest of the url + for i in "$@"; do + url=$url"$i""+" + done + + # opens url in browser + open $url +} \ No newline at end of file