Files
TerminalPolyjuice/zsh/alias/python_alias.sh
2026-01-24 21:45:48 +08:00

17 lines
487 B
Bash

if (( $+commands[python3] )); then
alias py='python3'
fi
function pyclean() {
find "${@:-.}" -type f -name "*.py[co]" -delete
find "${@:-.}" -type d -name "__pycache__" -delete
find "${@:-.}" -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
find "${@:-.}" -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
}
# Grep among .py files
alias pygrep='grep -nr --include="*.py"'
# Share local directory as a HTTP server
alias pyserver="python3 -m http.server"