Created
July 4, 2021 12:43
-
-
Save bketelsen/8b7c3bd9d770a866b389e3934e6b2dee to your computer and use it in GitHub Desktop.
cleanup detritus from dev work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
│ File: .zsh/includes/cleanup.sh | |
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────── | |
1 │ cleanup () { | |
2 │ find ~/src -name 'node_modules' -type d -prune -exec rm -rf '{}' + | |
3 │ find ~/src -name '.next' -type d -prune -exec rm -rf '{}' + | |
4 │ cargo sweep -r -t 30 ~/src | |
5 │ brew cleanup | |
6 │ is_bin_in_path docker && docker system prune -a -f --volumes || echo "skipping docker" | |
7 │ } | |
8 │ # https://stackoverflow.com/questions/6569478/detect-if-executable-file-is-on-users-path | |
9 │ function is_bin_in_path { | |
10 │ if [[ -n $ZSH_VERSION ]]; then | |
11 │ builtin whence -p "$1" &> /dev/null | |
12 │ else # bash: | |
13 │ builtin type -P "$1" &> /dev/null | |
14 │ fi | |
15 │ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment