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
0818df05
Unverified
Commit
0818df05
authored
Apr 09, 2022
by
Carlo Sala
Committed by
GitHub
Apr 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: use `python3` for all `python` invocations (#10832)
parent
b3999a4b
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
17 deletions
+17
-17
aliases.plugin.zsh
plugins/aliases/aliases.plugin.zsh
+2
-2
cheatsheet.py
plugins/aliases/cheatsheet.py
+1
-1
README.md
plugins/git-prompt/README.md
+1
-1
git-prompt.plugin.zsh
plugins/git-prompt/git-prompt.plugin.zsh
+1
-1
gitstatus.py
plugins/git-prompt/gitstatus.py
+1
-1
jsontools.plugin.zsh
plugins/jsontools/jsontools.plugin.zsh
+6
-6
pyenv.plugin.zsh
plugins/pyenv/pyenv.plugin.zsh
+1
-1
README.md
plugins/python/README.md
+1
-1
python.plugin.zsh
plugins/python/python.plugin.zsh
+3
-3
No files found.
plugins/aliases/aliases.plugin.zsh
View file @
0818df05
...
...
@@ -3,9 +3,9 @@
# - acs: alias cheatsheet
# group alias by command, pass addition argv to grep.
function
acs
(){
((
$+
commands[python]
))
||
{
((
$+
commands[python
3
]
))
||
{
echo
"[error] No python executable detected"
return
}
alias
| python
${
functions_source
[
$0
]
:h
}
/cheatsheet.py
$@
alias
| python
3
${
functions_source
[
$0
]
:h
}
/cheatsheet.py
$@
}
plugins/aliases/cheatsheet.py
View file @
0818df05
#!/usr/bin/env python
#!/usr/bin/env python
3
import
sys
import
itertools
import
termcolor
...
...
plugins/git-prompt/README.md
View file @
0818df05
...
...
@@ -13,7 +13,7 @@ See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements
This plugin uses
`python
`
, so your host needs to have it installed
This plugin uses
`python
3`
, so your host needs to have it installed.
## Examples
...
...
plugins/git-prompt/git-prompt.plugin.zsh
View file @
0818df05
...
...
@@ -36,7 +36,7 @@ function update_current_git_vars() {
unset
__CURRENT_GIT_STATUS
local
gitstatus
=
"
$__GIT_PROMPT_DIR
/gitstatus.py"
_GIT_STATUS
=
$(
python
${
gitstatus
}
2>/dev/null
)
_GIT_STATUS
=
$(
python
3
${
gitstatus
}
2>/dev/null
)
__CURRENT_GIT_STATUS
=(
"
${
(@s
:
:
)_GIT_STATUS
}
"
)
GIT_BRANCH
=
$__CURRENT_GIT_STATUS
[
1]
GIT_AHEAD
=
$__CURRENT_GIT_STATUS
[
2]
...
...
plugins/git-prompt/gitstatus.py
View file @
0818df05
#!/usr/bin/env python
#!/usr/bin/env python
3
from
__future__
import
print_function
import
os
...
...
plugins/jsontools/jsontools.plugin.zsh
View file @
0818df05
...
...
@@ -8,7 +8,7 @@ fi
# If method undefined, find the first one that is installed
if
[[
-z
"
$JSONTOOLS_METHOD
"
]]
;
then
for
JSONTOOLS_METHOD
in
node python ruby
;
do
for
JSONTOOLS_METHOD
in
node python
3
ruby
;
do
# If method found, break out of loop
((
$+
commands[
$JSONTOOLS_METHOD
]
))
&&
break
# Otherwise unset the variable
...
...
@@ -45,12 +45,12 @@ case "$JSONTOOLS_METHOD" in
xargs
-0
node
-e
"console.log(decodeURIComponent(process.argv[1]))"
}
;;
python
)
python
3
)
function
pp_json
()
{
python
-c
'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
python
3
-c
'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
}
function
is_json
()
{
python
-c
'
python
3
-c
'
import sys; del sys.path[0];
import json
try:
...
...
@@ -61,14 +61,14 @@ except ValueError:
'
}
function
urlencode_json
()
{
python
-c
'
python
3
-c
'
import sys; del sys.path[0];
from urllib.parse import quote_plus
print(quote_plus(sys.stdin.read()))
'
}
function
urldecode_json
()
{
python
-c
'
python
3
-c
'
import sys; del sys.path[0];
from urllib.parse import unquote_plus
print(unquote_plus(sys.stdin.read()))
...
...
plugins/pyenv/pyenv.plugin.zsh
View file @
0818df05
...
...
@@ -89,7 +89,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
else
# Fall back to system python
function
pyenv_prompt_info
()
{
local
version
=
"
$(
python
-V
2>&1 |
cut
-d
' '
-f2
)
"
local
version
=
"
$(
python
3
-V
2>&1 |
cut
-d
' '
-f2
)
"
echo
"system:
${
version
:gs/%/%%
}
"
}
fi
...
...
plugins/python/README.md
View file @
0818df05
...
...
@@ -12,7 +12,7 @@ plugins=(... python)
| Command | Description |
| ---------------- | -------------------------------------------------------------------------------------- |
|
`py`
| Runs
`python
`
|
|
`py`
| Runs
`python
3`
|
|
`ipython`
| Runs the appropriate
`ipython`
version according to the activated virtualenv |
|
`pyfind`
| Finds .py files recursively in the current directory |
|
`pyclean [dirs]`
| Deletes byte-code and cache files from a list of directories or the current one |
...
...
plugins/python/python.plugin.zsh
View file @
0818df05
# python command
alias
py
=
'python'
alias
py
=
'python
3
'
# Find python file
alias
pyfind
=
'find . -name "*.py"'
...
...
@@ -44,10 +44,10 @@ function pyuserpaths() {
alias
pygrep
=
'grep -nr --include="*.py"'
# Run proper IPython regarding current virtualenv (if any)
alias
ipython
=
"python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
alias
ipython
=
"python
3
-c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
# Share local directory as a HTTP server
alias
pyserver
=
"python -m http.server"
alias
pyserver
=
"python
3
-m http.server"
## venv utilities
...
...
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