style: make shell scripts follow shfmt

This commit is contained in:
Swarsel 2024-12-10 18:19:28 +01:00
parent 2a4740b6c9
commit 437bc79968
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
11 changed files with 167 additions and 139 deletions

View file

@ -5,11 +5,13 @@ otp=0
typeit=0
while :; do
case ${1:-} in
-t|--type) typeit=1
;;
-o|--otp) otp=1
;;
*) break
-t | --type)
typeit=1
;;
-o | --otp)
otp=1
;;
*) break ;;
esac
shift
done
@ -17,27 +19,33 @@ done
export PASSWORD_STORE_DIR=~/.local/share/password-store
prefix=${PASSWORD_STORE_DIR-~/.local/share/password-store}
if [[ $otp -eq 0 ]]; then
password_files=( "$prefix"/**/*.gpg )
password_files=("$prefix"/**/*.gpg)
else
password_files=( "$prefix"/otp/**/*.gpg )
password_files=("$prefix"/otp/**/*.gpg)
fi
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
password_files=("${password_files[@]#"$prefix"/}")
password_files=("${password_files[@]%.gpg}")
password=$(printf '%s\n' "${password_files[@]}" | fuzzel --dmenu "$@")
[[ -n $password ]] || exit
if [[ $otp -eq 0 ]]; then
if [[ $typeit -eq 0 ]]; then
pass show -c "$password" &>/tmp/pass-fuzzel
pass show -c "$password" &> /tmp/pass-fuzzel
else
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
pass show "$password" | {
IFS= read -r pass
printf %s "$pass"
} | wtype -
fi
else
if [[ $typeit -eq 0 ]]; then
pass otp -c "$password" &>/tmp/pass-fuzzel
pass otp -c "$password" &> /tmp/pass-fuzzel
else
pass otp "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
pass otp "$password" | {
IFS= read -r pass
printf %s "$pass"
} | wtype -
fi
fi
notify-send -u critical -a pass -t 1000 "Copied/Typed Password"