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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
12 deletions
+15
-12
django.plugin.zsh
plugins/django/django.plugin.zsh
+2
-1
jsontools.plugin.zsh
plugins/jsontools/jsontools.plugin.zsh
+8
-6
_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() {
_applist
()
{
local
line
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
\\
.stdout.write(str(re.sub(r'^%s
\.
(.*?)
$'
%
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
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]))"'
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 "
import json, sys;
import sys; del sys.path[0];
import json;
try:
json.loads(sys.stdin.read())
except ValueError, e:
...
...
@@ -22,11 +23,13 @@ else:
print True
sys.exit(0)"'
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())
sys.exit(0)"'
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())
sys.exit(0)"'
elif
[[
$(
whence ruby
)
!=
""
&&
(
"x
$JSONTOOLS_METHOD
"
=
"x"
||
"x
$JSONTOOLS_METHOD
"
=
"xruby"
)
]]
;
then
...
...
@@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET
alias
urldecode_json
=
'ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"'
fi
unset
JSONTOOLS_METHOD
\ No newline at end of file
unset
JSONTOOLS_METHOD
plugins/salt/_salt
View file @
1c98b9cc
...
...
@@ -271,7 +271,7 @@ _salt_comp(){
fi
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
fi
}
...
...
plugins/urltools/urltools.plugin.zsh
View file @
1c98b9cc
...
...
@@ -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
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
,
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
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
,
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
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
"
}
...
...
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