python alias

This commit is contained in:
2026-01-24 21:45:48 +08:00
parent 1a949c4497
commit f532737ed9
2 changed files with 19 additions and 2 deletions

View File

@@ -1 +1,16 @@
alias py='python3'
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"