summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-01-18 21:13:10 +0100
committerMarc Cornellà <marc.cornella@live.com>2016-01-18 21:13:10 +0100
commitd60cf5cb1079a2f523deab38eeb810b6959781da (patch)
tree92a056f14cfccf5ecd890a30b6fb385084a1f6ad /plugins
parent40016afdc4c4ecdab6092e4f8c5c8648e27e5524 (diff)
parent7daa207dbc92afc9bf1ea5bc41ff3e7611409f52 (diff)
downloadzsh-d60cf5cb1079a2f523deab38eeb810b6959781da.tar.gz
zsh-d60cf5cb1079a2f523deab38eeb810b6959781da.tar.bz2
zsh-d60cf5cb1079a2f523deab38eeb810b6959781da.zip
Merge branch 'slariviere-master'
Close #3747
Diffstat (limited to 'plugins')
-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