浏览代码

fix(python): set `py` alias if `py` is not installed (#12059)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
MikuHatsune39 5 月之前
父节点
当前提交
ddf673b36d
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      plugins/python/README.md
  2. 2 2
      plugins/python/python.plugin.zsh

+ 1 - 1
plugins/python/README.md

@@ -12,7 +12,7 @@ plugins=(... python)
 
 | Command          | Description                                                                            |
 | ---------------- | -------------------------------------------------------------------------------------- |
-| `py`             | Runs `python3`                                                                         |
+| `py`             | Runs `python3`. Only set if `py` is not installed.                                     |
 | `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        |

+ 2 - 2
plugins/python/python.plugin.zsh

@@ -1,5 +1,5 @@
-# python command
-alias py='python3'
+# set python command if 'py' not installed
+builtin which py > /dev/null || alias py='python3'
 
 # Find python file
 alias pyfind='find . -name "*.py"'