1
0
dotfiles/noire-carnation/functions
2023-12-18 12:47:55 -07:00

86 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
bmv() {
set -x
if test -z "$1"; then
printf "Usage: %s pattern pattern1 [pattern2]\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
for file in $1; do
newfile="$(printf '%s\n' "$file" | sed "s;$2;$3;g")"
if [ "$file" != "$newfile" ]
then
mv "$file" "$newfile"
fi
done
set +x
}
ix() {
curl -F 'f:1=<-' ix.io
}
myip() {
curl icanhazip.com
}
honse() {
if test -z "$2"; then
printf "Usage: %s season episode\n" "$0"
return 64 # syexits.h(3) EX_USAGE
else
mpv "https://ypdl.gdn/files/YP-1S-$1x$2.mkv"
fi
}
#TODO: Really needs fixed
paclean() {
for package in `pacman -Qtq`; do
pacman -Qi "$package"
printf "Uninstall? [y/N] "
read resp
# TODO: Add undo
if [ "$resp" != "y" ] && [ "$resp" != "Y" ]; then
printf "Skipped %s.\n\n" "$package" 1>&2
else
printf "Queued %s for uninstall.\n\n" "$package" 1>&2
packages="$packages$package "
fi
done
su -c "pacman -Rns $packages"
}
sc() {
if test -z "$1"; then
printf "Usage: %s URI\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
scdl --original-name --debug -l "$1" >> log 2>&1
}
up() { # updates everything on the system
command -v apk >/dev/null && su -c 'apk update'
command -v cargo-install-update >/dev/null && cargo install-update --all --git
command -v kiss >/dev/null && su -c 'kiss u' && su -c 'kiss U'
command -v nvim >/dev/null && nvim +PlugUpdate -c x -c x
if command -v paru >/dev/null; then paru
elif command -v pacman >/dev/null; then su -c 'pacman -Syyu'; fi
CWD="$PWD"
command -v git >/dev/null && \
for dir in $HOME/.local/src/git/*/*/*/
do
printf '%s\n' "$dir"
cd "$dir"
git pull --all
done
cd "$CWD"
}