mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
fix(pip): don't overwrite requirements.txt
in internal commands (#10061)
This commit is contained in:
parent
eec34b32fa
commit
2acb3071ca
1 changed files with 14 additions and 4 deletions
|
@ -91,11 +91,21 @@ fi
|
||||||
# Create requirements file
|
# Create requirements file
|
||||||
alias pipreq="pip freeze > requirements.txt"
|
alias pipreq="pip freeze > requirements.txt"
|
||||||
|
|
||||||
# Update all installed packages
|
|
||||||
alias pipupall="pipreq && sed -i 's/==/>=/g' requirements.txt && pip install -r requirements.txt --upgrade && rm -rf requirements.txt"
|
|
||||||
|
|
||||||
# Install packages from requirements file
|
# Install packages from requirements file
|
||||||
alias pipir="pip install -r requirements.txt"
|
alias pipir="pip install -r requirements.txt"
|
||||||
|
|
||||||
|
# Update all installed packages
|
||||||
|
function pipupall {
|
||||||
|
# non-GNU xargs does not support nor need `--no-run-if-empty`
|
||||||
|
local xargs="xargs --no-run-if-empty"
|
||||||
|
xargs --version 2>/dev/null | grep -q GNU || xargs="xargs"
|
||||||
|
pip list --outdated --format freeze | cut -d= -f1 | ${=xargs} pip install --upgrade
|
||||||
|
}
|
||||||
|
|
||||||
# Uninstalled all installed packages
|
# Uninstalled all installed packages
|
||||||
alias pipunall="pipreq && pip uninstall -r requirements.txt -y && rm -rf requirements.txt"
|
function pipunall {
|
||||||
|
# non-GNU xargs does not support nor need `--no-run-if-empty`
|
||||||
|
local xargs="xargs --no-run-if-empty"
|
||||||
|
xargs --version 2>/dev/null | grep -q GNU || xargs="xargs"
|
||||||
|
pip list --format freeze | cut -d= -f1 | ${=xargs} pip uninstall
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue