Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
c164f2aa
Commit
c164f2aa
authored
Jul 01, 2013
by
dongweiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shell built method
parent
46d4606e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
urltools.plugin.zsh
plugins/urltools/urltools.plugin.zsh
+4
-1
No files found.
plugins/urltools/urltools.plugin.zsh
View file @
c164f2aa
...
@@ -14,6 +14,9 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
...
@@ -14,6 +14,9 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
elif
[[
$(
whence python
)
!=
""
&&
(
"x
$URLTOOLS_METHOD
"
=
"x"
||
"x
$URLTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
elif
[[
$(
whence python
)
!=
""
&&
(
"x
$URLTOOLS_METHOD
"
=
"x"
||
"x
$URLTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
alias
urlencode
=
'python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias
urlencode
=
'python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias
urldecode
=
'python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias
urldecode
=
'python -c "import sys, 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
elif
[[
$(
whence ruby
)
!=
""
&&
(
"x
$URLTOOLS_METHOD
"
=
"x"
||
"x
$URLTOOLS_METHOD
"
=
"xruby"
)
]]
;
then
alias
urlencode
=
'ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
alias
urlencode
=
'ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
alias
urldecode
=
'ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
alias
urldecode
=
'ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
...
@@ -33,4 +36,4 @@ elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHO
...
@@ -33,4 +36,4 @@ elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHO
fi
fi
fi
fi
unset
URLTOOLS_METHOD
unset
URLTOOLS_METHOD
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment