diff --git a/.config/shell/browse b/.config/shell/browse index 4b74406..2cd6817 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -1,7 +1,7 @@ # Utilities regarding file system navigation # Useful when the current directory was recreated -alias rcd="cd $PWD" +alias recd='cd $PWD' # cd into the parent if arg is a file cdd() { cd "$@" 2>/dev/null || cd "$(dirname "$1")" "${@:2}" } diff --git a/.config/shell/functions b/.config/shell/functions index f0266bc..fa875d9 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -300,6 +300,7 @@ which perl-rename >/dev/null && # rsync directory properly - suffix both dirs with / to act on contents alias rcn='rsync -v --recursive --human-readable --links --dry-run' +rcd() { rcn --size-only "$@" | tail +2 | tree --fromfile . | less -F; } alias rc='rcs --links --times' alias rcu='rc --existing --size-only' alias rcs='rsync --recursive --info=progress2,remove,symsafe,flist,del --human-readable' diff --git a/.local/bin/scripts/clean b/.local/bin/scripts/clean index 7d1df84..598c44f 100755 --- a/.local/bin/scripts/clean +++ b/.local/bin/scripts/clean @@ -20,28 +20,31 @@ do "$local" >/dev/null 2>&1 && f="$(echo "$f" | sed "s|$HOME|$($loc)|")" done find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete -highlight "e to recursively remove empty folders and files" +highlight "e :: recursively remove empty folders and files" [[ $1 =~ "e" ]] && find -empty -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete for k in "${!_clean_map[@]}"; do folder="${_clean_map[$k]}" - highlight "$k to delete $folder" + highlight "$k :: delete $folder" [[ $1 =~ "$k" ]] && sudo rm $i -rf "$folder" && echo "Deleted $folder" done -highlight "m to recursively remove mac-files" +highlight "s :: recursively remove logs" +[[ $1 =~ "s" ]] && find \( -name "logs" -prune -o -name "crash-reports" -prune -o -iname "*log.txt" -o -name "*.log.*" -o -iname "*.log" \) -print -exec rm -rI {} + + +highlight "m :: recursively remove mac-files" if [[ $1 =~ "m" ]]; then find -iname '.spotlight*' -exec rm -rI {} + find -name '*.DS_Store' -delete fi -highlight "g to clean gradle" +highlight "g :: clean gradle" if [[ $1 =~ "g" ]]; then find "${GRADLE_USER_HOME:-$HOME/.gradle}" -mindepth 1 -maxdepth 1 -type d -print -exec rm $i -r {} + find $PROJECTS -name .gradle -print -exec rm $i -r {} + fi -highlight "c to clean electron caches" +highlight "c :: clean electron caches" [[ $1 =~ "c" ]] && find "$dir$(expr "${XDG_CONFIG_HOME/$HOME}" \| "/.config")" \ -type d -name "*Cache" -print -exec rm $i -r {} + -prune @@ -51,7 +54,7 @@ if test -f "/var/log/apt/history.log"; then export aptclean_last=$aptclean_cur fi -highlight "d to recursively remove development caches" +highlight "d :: recursively remove development caches" if [[ $1 =~ "d" ]]; then find -name "src" -prune -o \ -type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name \1|g') \) \ @@ -64,7 +67,7 @@ if [[ $1 =~ "d" ]]; then -print -exec rm -rI {} + -prune fi -highlight "o to optimize space extensively" +highlight "o :: optimize space extensively" if [[ $1 =~ "o" ]]; then which yay &>/dev/null && yay -Sc --noconfirm nix-collect-garbage -d diff --git a/.local/bin/scripts/ex b/.local/bin/scripts/ex index 52540e5..3feff9a 100755 --- a/.local/bin/scripts/ex +++ b/.local/bin/scripts/ex @@ -26,6 +26,8 @@ for arg do (*.Z) uncompress "$path";; (*) echo "'$arg' cannot be extracted by ex" >&2;; esac + test "$(ls -U | wc -l)" -lt 3 && + mv */* . && find -empty -delete ) else echo "'$1' is not a readable file" diff --git a/.local/bin/scripts/latest b/.local/bin/scripts/latest index d0525f1..7c4983e 100755 --- a/.local/bin/scripts/latest +++ b/.local/bin/scripts/latest @@ -1,5 +1,8 @@ #!/bin/sh -e # Displays the latest files in the given directory or pwd test "$1" = "-a" && all=true && shift -find "${1:-$PWD}" -maxdepth 4 -type f -printf '%.16T+ %P\n' | +for f in "${@:-PWD}" +do test $# -gt 1 && highlight "$f" + find "$f" -maxdepth 4 -type f -printf '%.16T+ %P\n' | sort -r | $(test "$all" && echo "less" || echo "head") +done diff --git a/.zprofile b/.zprofile index d50480d..d34e9f3 100644 --- a/.zprofile +++ b/.zprofile @@ -114,7 +114,7 @@ export CTEST_OUTPUT_ON_FAILURE=1 export CTEST_PARALLEL_LEVEL=3 if test -z "$DISPLAY" && test "$XDG_VTNR" -eq 1 && test -e "$JOURNAL"; then - echo "What do you want to do?" + echo "What do you want to do? Check your planner!" while test $(echo "$intention" | wc -c) -lt 6 do read intention done