summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/urltools
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/oh-my-zsh/plugins/urltools')
-rw-r--r--zsh/oh-my-zsh/plugins/urltools/README.md29
-rw-r--r--zsh/oh-my-zsh/plugins/urltools/urltools.plugin.zsh42
2 files changed, 0 insertions, 71 deletions
diff --git a/zsh/oh-my-zsh/plugins/urltools/README.md b/zsh/oh-my-zsh/plugins/urltools/README.md
deleted file mode 100644
index 29c3710..0000000
--- a/zsh/oh-my-zsh/plugins/urltools/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# URLTools plugin
-
-This plugin provides two aliases to URL-encode and URL-decode strings.
-
-To start using it, add the `urltools` plugin to your plugins array in `~/.zshrc`:
-
-```zsh
-plugins=(... urltools)
-```
-
-Original author: [Ian Chesal](https://github.com/ianchesal)
-Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/)
-
-## Commands
-
-| Command | Description |
-| :---------- | :--------------------------- |
-| `urlencode` | URL-encodes the given string |
-| `urldecode` | URL-decodes the given string |
-
-## Examples
-
-```zsh
-urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code'
-# returns https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode
-
-urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
-# returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code
-```
diff --git a/zsh/oh-my-zsh/plugins/urltools/urltools.plugin.zsh b/zsh/oh-my-zsh/plugins/urltools/urltools.plugin.zsh
deleted file mode 100644
index b443e50..0000000
--- a/zsh/oh-my-zsh/plugins/urltools/urltools.plugin.zsh
+++ /dev/null
@@ -1,42 +0,0 @@
-# URL Tools
-# Adds handy command line aliases useful for dealing with URLs
-#
-# Taken from:
-# https://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
-
-if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
- URLTOOLS_METHOD=""
-fi
-
-if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
- alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
- alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
-elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
- alias urldecode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
-elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.quote_plus(sys.argv[1])"'
- alias urldecode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.unquote_plus(sys.argv[1])"'
-elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
- function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
- function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
-elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then
- alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
- alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
-elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then
- alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"'
- alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"'
-elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then
- if perl -MURI::Encode -e 1&> /dev/null; then
- alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"'
- alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"'
- elif perl -MURI::Escape -e 1 &> /dev/null; then
- alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"'
- alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"'
- else
- alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'"
- alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'"
- fi
-fi
-
-unset URLTOOLS_METHOD