bin: various function improvements

This commit is contained in:
xeruf 2023-05-25 21:37:55 +01:00
parent c5500b3ee0
commit 9056b4f474
5 changed files with 22 additions and 11 deletions

View File

@ -371,6 +371,10 @@ alias fc='fossil commit -v'
fdf() { fdf() {
fossil diff "$@" | clr fossil diff "$@" | clr
} }
fuu() {
rm .fslckout
fossil open *.fossil --keep
}
alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
@ -456,15 +460,17 @@ updateDeps() {
esac esac
shift 2 shift 2
done done
echo name "'$name'" depth "'$depth'" pattern "'$oldversion'" version "'$version'" echo name "'$name'" depth "'$depth'" pattern "'$oldversion'" version "'$version'" >&2
find -maxdepth $depth -not \( -name "*forks" -prune \) -type f -name $name | while read f find -maxdepth $depth -not \( -name "*forks" -prune \) -type f -name $name |
do highlight $f while read f
sed -i "s/\($pattern\)\($oldversion\)/\1${version:-\2}/gw /dev/stdout" $f do highlight $f
done sed -i "s/\($pattern\)\($oldversion\)/\1${version:-\2}/gw /dev/stdout" $f
done
} }
alias updateKotlin="updateDeps build.gradle.kts 'kotlin(\"jvm\") version \"' --version" alias updateKotlin="updateDeps build.gradle.kts 'kotlin(\"jvm\") version \"' --version"
alias updateGradle='updateDeps gradle-wrapper.properties "services.gradle.org\/distributions\/gradle-" --version' alias updateGradle='updateDeps gradle-wrapper.properties "services.gradle.org\/distributions\/gradle-" --version'
alias updateUtils="updateDeps build.gradle.kts '"'"com.github.Xerus2000.util", ".*", "'" --pattern '[^\"]\+' --version" alias updateUtils="updateDeps build.gradle.kts '"'"com.github.Xerus2000.util", ".*", "'" --pattern '[^\"]\+' --version"
updateKarma() { rpl "karma-runner.github.io/[^/]\+/" "karma-runner.github.io/$1/"; }
# Kill all shell background processes # Kill all shell background processes
alias killbg='kill ${${(v)jobstates##*:*:}%=*}' alias killbg='kill ${${(v)jobstates##*:*:}%=*}'

View File

@ -38,7 +38,7 @@ alias fixmime='sudo rm /usr/share/mime/packages/kde.xml && sudo update-mime-data
theme_save="$XDG_CACHE_HOME/theme" theme_save="$XDG_CACHE_HOME/theme"
#theme_default="$(d=$(date +%H) && test $d -gt 7 && test $d -lt 19 && echo light || echo dark)" #theme_default="$(d=$(date +%H) && test $d -gt 7 && test $d -lt 19 && echo light || echo dark)"
theme_default="dark" theme_default="dark"
theme() { themeswitch() {
theme="$1" theme="$1"
if test "$2" = "kde" if test "$2" = "kde"
then kcmshell5 kcm_lookandfeel then kcmshell5 kcm_lookandfeel
@ -72,4 +72,4 @@ theme() {
} }
export THEME=$(cat "$theme_save" 2> /dev/null) export THEME=$(cat "$theme_save" 2> /dev/null)
export THEME=${THEME:-$theme_default} export THEME=${THEME:-$theme_default}
theme $THEME themeswitch $THEME

View File

@ -1,5 +1,7 @@
#!/bin/sh -e #!/bin/sh
# Suspend screen until enter is pressed # Suspend screen until enter is pressed
xset dpms force off xset dpms force off
swaymsg "output * dpms off"
read read
xset dpms force on xset dpms force on
swaymsg "output * dpms on"

View File

@ -1,3 +1,3 @@
#!/bin/sh -ex #!/bin/sh -ex
# Set exec flag on all files that should be executable # Set exec flag on all files that should be executable
find -maxdepth 4 -name "*.sh" "$@" -exec chmod -v +x {} + find -maxdepth 4 -name "*.sh" -o -path '*/githooks/*' "$@" -exec chmod -v +x {} +

View File

@ -1,6 +1,9 @@
#!/bin/sh #!/bin/sh
# Upload website to iridion # Upload website to iridion
# TODO: derive from id if test $# -eq 0
then echo "$0 site [index.html] [USER]"
else
site=$1 site=$1
shift shift
scp -r "$@" "iridion:web/$site/public_html$(test "$#" -gt 1 || echo '/index.html')" scp -r "$@" "iridion:/home/${2:-$USER}/web/$site/public_html$(test "$#" -gt 1 || echo '/index.html')"
fi