summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Larivière <sebastien@lariviere.me>2015-04-04 20:24:24 -0400
committerMarc Cornellà <marc.cornella@live.com>2016-01-18 21:01:04 +0100
commit7daa207dbc92afc9bf1ea5bc41ff3e7611409f52 (patch)
tree92a056f14cfccf5ecd890a30b6fb385084a1f6ad
parent40016afdc4c4ecdab6092e4f8c5c8648e27e5524 (diff)
downloadzsh-7daa207dbc92afc9bf1ea5bc41ff3e7611409f52.tar.gz
zsh-7daa207dbc92afc9bf1ea5bc41ff3e7611409f52.tar.bz2
zsh-7daa207dbc92afc9bf1ea5bc41ff3e7611409f52.zip
Adding support for stdin input in the encode64 plugin
-rw-r--r--plugins/encode64/encode64.plugin.zsh17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 53de6478a..979e06742 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,4 +1,17 @@
-encode64(){ printf '%s' $1 | base64 }
-decode64(){ printf '%s' $1 | base64 --decode }
+encode64() {
+ if [[ $# -eq 0 ]]; then
+ cat | base64
+ else
+ printf '%s' $1 | base64
+ fi
+}
+
+decode64() {
+ if [[ $# -eq 0 ]]; then
+ cat | base64 --decode
+ else
+ printf '%s' $1 | base64 --decode
+ fi
+}
alias e64=encode64
alias d64=decode64