mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 02:20:09 +00:00
fix: use python3
for all python
invocations (#10832)
This commit is contained in:
parent
b3999a4b15
commit
0818df057c
9 changed files with 17 additions and 17 deletions
|
@ -3,9 +3,9 @@
|
|||
# - acs: alias cheatsheet
|
||||
# group alias by command, pass addition argv to grep.
|
||||
function acs(){
|
||||
(( $+commands[python] )) || {
|
||||
(( $+commands[python3] )) || {
|
||||
echo "[error] No python executable detected"
|
||||
return
|
||||
}
|
||||
alias | python ${functions_source[$0]:h}/cheatsheet.py $@
|
||||
alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import itertools
|
||||
import termcolor
|
||||
|
|
|
@ -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 `python3`, so your host needs to have it installed.
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -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=$(python3 ${gitstatus} 2>/dev/null)
|
||||
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
|
|
@ -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 python3 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)
|
||||
python3)
|
||||
function pp_json() {
|
||||
python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
|
||||
python3 -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
|
||||
}
|
||||
function is_json() {
|
||||
python -c '
|
||||
python3 -c '
|
||||
import sys; del sys.path[0];
|
||||
import json
|
||||
try:
|
||||
|
@ -61,14 +61,14 @@ except ValueError:
|
|||
'
|
||||
}
|
||||
function urlencode_json() {
|
||||
python -c '
|
||||
python3 -c '
|
||||
import sys; del sys.path[0];
|
||||
from urllib.parse import quote_plus
|
||||
print(quote_plus(sys.stdin.read()))
|
||||
'
|
||||
}
|
||||
function urldecode_json() {
|
||||
python -c '
|
||||
python3 -c '
|
||||
import sys; del sys.path[0];
|
||||
from urllib.parse import unquote_plus
|
||||
print(unquote_plus(sys.stdin.read()))
|
||||
|
|
|
@ -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="$(python3 -V 2>&1 | cut -d' ' -f2)"
|
||||
echo "system: ${version:gs/%/%%}"
|
||||
}
|
||||
fi
|
||||
|
|
|
@ -12,7 +12,7 @@ plugins=(... python)
|
|||
|
||||
| Command | Description |
|
||||
| ---------------- | -------------------------------------------------------------------------------------- |
|
||||
| `py` | Runs `python` |
|
||||
| `py` | Runs `python3` |
|
||||
| `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 |
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# python command
|
||||
alias py='python'
|
||||
alias py='python3'
|
||||
|
||||
# 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="python3 -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
|
||||
|
||||
# Share local directory as a HTTP server
|
||||
alias pyserver="python -m http.server"
|
||||
alias pyserver="python3 -m http.server"
|
||||
|
||||
|
||||
## venv utilities
|
||||
|
|
Loading…
Reference in a new issue