mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 15:30:15 +08:00
feat(pip): add several aliases (#10647)
This commit is contained in:
parent
f4dc8c5be3
commit
cc5100d1e9
@ -22,6 +22,14 @@ the next time you autocomplete `pip install`.
|
|||||||
|
|
||||||
| Alias | Description |
|
| Alias | Description |
|
||||||
| :------- | :-------------------------------------------- |
|
| :------- | :-------------------------------------------- |
|
||||||
|
| pipi | Install packages |
|
||||||
|
| pipig | Install package from GitHub repository |
|
||||||
|
| pipigb | Install package from GitHub branch |
|
||||||
|
| pipigp | Install package from GitHub pull request |
|
||||||
|
| pipu | Upgrade packages |
|
||||||
|
| pipun | Uninstall packages |
|
||||||
|
| pipgi | Grep through installed packages |
|
||||||
|
| piplo | List outdated packages |
|
||||||
| pipreq | Create requirements file |
|
| pipreq | Create requirements file |
|
||||||
| pipir | Install packages from `requirements.txt` file |
|
| pipir | Install packages from `requirements.txt` file |
|
||||||
| pipupall | Update all installed packages |
|
| pipupall | Update all installed packages |
|
||||||
|
@ -88,6 +88,12 @@ else
|
|||||||
alias pip="noglob pip"
|
alias pip="noglob pip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
alias pipi="pip install"
|
||||||
|
alias pipu="pip install --upgrade"
|
||||||
|
alias pipun="pip uninstall"
|
||||||
|
alias pipgi="pip freeze | grep"
|
||||||
|
alias piplo="pip list -o"
|
||||||
|
|
||||||
# Create requirements file
|
# Create requirements file
|
||||||
alias pipreq="pip freeze > requirements.txt"
|
alias pipreq="pip freeze > requirements.txt"
|
||||||
|
|
||||||
@ -102,10 +108,28 @@ function pipupall {
|
|||||||
pip list --outdated | awk 'NR > 2 { print $1 }' | ${=xargs} pip install --upgrade
|
pip list --outdated | awk 'NR > 2 { print $1 }' | ${=xargs} pip install --upgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
# Uninstalled all installed packages
|
# Uninstall all installed packages
|
||||||
function pipunall {
|
function pipunall {
|
||||||
# non-GNU xargs does not support nor need `--no-run-if-empty`
|
# non-GNU xargs does not support nor need `--no-run-if-empty`
|
||||||
local xargs="xargs --no-run-if-empty"
|
local xargs="xargs --no-run-if-empty"
|
||||||
xargs --version 2>/dev/null | grep -q GNU || xargs="xargs"
|
xargs --version 2>/dev/null | grep -q GNU || xargs="xargs"
|
||||||
pip list --format freeze | cut -d= -f1 | ${=xargs} pip uninstall
|
pip list --format freeze | cut -d= -f1 | ${=xargs} pip uninstall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install from GitHub repository
|
||||||
|
function pipig {
|
||||||
|
pip install "git+https://github.com/$1.git"
|
||||||
|
}
|
||||||
|
compdef _pip pipig
|
||||||
|
|
||||||
|
# Install from GitHub branch
|
||||||
|
function pipigb {
|
||||||
|
pip install "git+https://github.com/$1.git@$2"
|
||||||
|
}
|
||||||
|
compdef _pip pipigb
|
||||||
|
|
||||||
|
# Install from GitHub pull request
|
||||||
|
function pipigp {
|
||||||
|
pip install "git+https://github.com/$1.git@refs/pull/$2/head"
|
||||||
|
}
|
||||||
|
compdef _pip pipigp
|
||||||
|
Loading…
Reference in New Issue
Block a user