Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
1c98b9cc
Unverified
Commit
1c98b9cc
authored
Nov 21, 2019
by
Marc Cornellà
Committed by
GitHub
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove current directory from sys.path in python invocations (#8408)
* Remove current directory from sys.path in python invocations
parent
b80b1a1e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
django.plugin.zsh
plugins/django/django.plugin.zsh
+2
-1
jsontools.plugin.zsh
plugins/jsontools/jsontools.plugin.zsh
+7
-4
_salt
plugins/salt/_salt
+1
-1
urltools.plugin.zsh
plugins/urltools/urltools.plugin.zsh
+4
-4
No files found.
plugins/django/django.plugin.zsh
View file @
1c98b9cc
...
@@ -374,7 +374,8 @@ _managepy-commands() {
...
@@ -374,7 +374,8 @@ _managepy-commands() {
_applist
()
{
_applist
()
{
local
line
local
line
local
-a
apps
local
-a
apps
_call_program help-command
"python -c
\"
import os.path as op, re, django.conf, sys;
\\
_call_program help-command
"python -c
\"
import sys; del sys.path[0];
\\
import os.path as op, re, django.conf;
\\
bn=op.basename(op.abspath(op.curdir));[sys
\\
bn=op.basename(op.abspath(op.curdir));[sys
\\
.stdout.write(str(re.sub(r'^%s
\.
(.*?)
$'
%
.stdout.write(str(re.sub(r'^%s
\.
(.*?)
$'
%
bn, r'
\1
', i)) + '
\n
') for i in django.conf.settings.
\\
bn, r'
\1
', i)) + '
\n
') for i in django.conf.settings.
\\
...
...
plugins/jsontools/jsontools.plugin.zsh
View file @
1c98b9cc
...
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
...
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
alias
urlencode_json
=
'xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias
urlencode_json
=
'xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias
urldecode_json
=
'xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
alias
urldecode_json
=
'xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif
[[
$(
whence python
)
!=
""
&&
(
"x
$JSONTOOLS_METHOD
"
=
"x"
||
"x
$JSONTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
elif
[[
$(
whence python
)
!=
""
&&
(
"x
$JSONTOOLS_METHOD
"
=
"x"
||
"x
$JSONTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
alias
pp_json
=
'python -
mjson.tool
'
alias
pp_json
=
'python -
c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"
'
alias
is_json
=
'python -c "
alias
is_json
=
'python -c "
import json, sys;
import sys; del sys.path[0];
import json;
try:
try:
json.loads(sys.stdin.read())
json.loads(sys.stdin.read())
except ValueError, e:
except ValueError, e:
...
@@ -22,11 +23,13 @@ else:
...
@@ -22,11 +23,13 @@ else:
print True
print True
sys.exit(0)"'
sys.exit(0)"'
alias
urlencode_json
=
'python -c "
alias
urlencode_json
=
'python -c "
import urllib, json, sys;
import sys; del sys.path[0];
import urllib, json;
print urllib.quote_plus(sys.stdin.read())
print urllib.quote_plus(sys.stdin.read())
sys.exit(0)"'
sys.exit(0)"'
alias
urldecode_json
=
'python -c "
alias
urldecode_json
=
'python -c "
import urllib, json, sys;
import sys; del sys.path[0];
import urllib, json;
print urllib.unquote_plus(sys.stdin.read())
print urllib.unquote_plus(sys.stdin.read())
sys.exit(0)"'
sys.exit(0)"'
elif
[[
$(
whence ruby
)
!=
""
&&
(
"x
$JSONTOOLS_METHOD
"
=
"x"
||
"x
$JSONTOOLS_METHOD
"
=
"xruby"
)
]]
;
then
elif
[[
$(
whence ruby
)
!=
""
&&
(
"x
$JSONTOOLS_METHOD
"
=
"x"
||
"x
$JSONTOOLS_METHOD
"
=
"xruby"
)
]]
;
then
...
...
plugins/salt/_salt
View file @
1c98b9cc
...
@@ -271,7 +271,7 @@ _salt_comp(){
...
@@ -271,7 +271,7 @@ _salt_comp(){
fi
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
salt_dir="${$(python2 -c 'import s
ys; del sys.path[0]; import s
alt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
_store_cache salt/salt_dir salt_dir
fi
fi
}
}
...
...
plugins/urltools/urltools.plugin.zsh
View file @
1c98b9cc
...
@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
...
@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
alias
urlencode
=
'node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias
urlencode
=
'node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias
urldecode
=
'node -e "console.log(decodeURIComponent(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
elif
[[
$(
whence python3
)
!=
""
&&
(
"x
$URLTOOLS_METHOD
"
=
"x"
||
"x
$URLTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
alias
urlencode
=
'python3 -c "import sys
,
urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
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
,
urllib.parse as up; print(up.unquote_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
elif
[[
$(
whence python2
)
!=
""
&&
(
"x
$URLTOOLS_METHOD
"
=
"x"
||
"x
$URLTOOLS_METHOD
"
=
"xpython"
)
]]
;
then
alias
urlencode
=
'python2 -c "import sys
,
urllib as ul; print ul.quote_plus(sys.argv[1])"'
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
,
urllib as ul; print ul.unquote_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
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
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
"
}
function
urldecode
()
{
printf
$(
echo
-n
$@
|
sed
's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g'
)
"
\n
"
}
...
...
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