-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.bash
More file actions
71 lines (62 loc) · 1.87 KB
/
functions.bash
File metadata and controls
71 lines (62 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# Ensure the pager is used for certain Subversion operations.
svn() {
if [[ "$1" == "diff" ]] || [[ "$1" == "log" ]] || [[ "$1" == "blame" ]]; then
command svn "$@" | less
else
command svn "$@"
fi
}
# Print all containers and images visible to buildah.
buildah_print() {
buildah containers --all
buildah images --all
}
buildah_prune() {
buildah containers --all
buildah rm --all
buildah containers --all
buildah images --all
buildah rmi --prune
buildah rmi --all
buildah images --all
}
docker_prune() {
docker container prune
docker image prune --all
docker container ls --all
docker image ls --all
}
# Print all containers and images visible to podman.
podman_print() {
podman container ls --all
podman container ls --external || _=$?
podman image ls --all
}
podman_prune() {
podman container prune
podman image prune --all
podman image prune --external
podman system prune --all
podman system prune --external
}
# Taken from
# https://github.com/robbyrussell/oh-my-zsh/blob/a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab/plugins/python/python.plugin.zsh#L6
pyclean() {
PYCLEAN_PLACES=${*:-'.'}
find ${PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${PYCLEAN_PLACES} -type d -name "__pycache__" -delete
find ${PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
find ${PYCLEAN_PLACES} -type d -name ".pytest_cache" -delete
find ${PYCLEAN_PLACES} -type d -name ".ruff_cache" -delete
find ${PYCLEAN_PLACES} -type d -name "htmlcov" -delete
}
spack-checksum-add() {
spack checksum --batch --add-to-package ${1}
}
# Remove Spack-generated modules from the MODULEPATH (module avail, module
# load, ...).
spack_remove_modulepath() {
MODULEPATH="$(echo "${MODULEPATH}" | tr ':' '\n' | sed '/spack/d' | tr '\n' ':')"
export MODULEPATH
}