limit every line to 80 characters
arĉi arcxi@dismail.de
Sat, 06 Jul 2024 14:51:38 +0200
9 files changed,
34 insertions(+),
30 deletions(-)
M
contrib/pa-completion.bash
→
contrib/pa-completion.bash
@@ -3,7 +3,7 @@ [[ $COMP_CWORD -eq 2 ]] && case "${COMP_WORDS[1]}" in [des]*)
names=() # Escape all password names so compgen doesn't break. - while read -r name; do names+=("${name@Q}"); done < <(pa list) + while read -r name; do names+=("${name@Q}"); done < <(pa l) mapfile -t COMPREPLY < <(compgen -W "${names[*]}" -- "${COMP_WORDS[2]}") ;;
M
contrib/pa-completion.fish
→
contrib/pa-completion.fish
@@ -4,4 +4,4 @@ test (count $cmd) -eq 2; and string match -q -r '^[des]' $cmd[2]
end complete -c pa -f -complete -c pa -n "__fish_complete_pa_name" -a "(pa list)" +complete -c pa -n "__fish_complete_pa_name" -a "(pa l)"
M
contrib/pa-fuzzel
→
contrib/pa-fuzzel
@@ -4,6 +4,6 @@ # prompt for a password via fuzzel
# generate new password if it doesn't exist # then type the selected password via wtype -name=$(pa list | fuzzel -dmenu "$@") || exit -{ pa show "$name" || { printf y | pa add "$name" >/dev/null && pa show "$name"; }; } | +name=$(pa l | fuzzel -dmenu "$@") || exit +{ pa s "$name" || { printf y | pa a "$name" >/dev/null && pa s "$name"; }; } | head -n 1 | tr -d '\n' | wtype -
M
contrib/pa-pass
→
contrib/pa-pass
@@ -10,14 +10,15 @@ basedir=${XDG_DATA_HOME:=$HOME/.local/share}/pa
: "${PA_DIR:=$basedir/passwords}" # Create pa store if it doesn't exist. -pa list >/dev/null || exit +pa l >/dev/null || exit age=$(command -v age || command -v rage) find "$PASSWORD_STORE_DIR" -name '*.gpg' | while read -r passfile; do name=$(printf %s "${passfile#"$PASSWORD_STORE_DIR/"}" | sed 's/\.gpg$//') mkdir -p "$PA_DIR/$(dirname "./$name")" - gpg2 -d "$passfile" | $age -R "$basedir/recipients" -o "$PA_DIR/$name.age" && + gpg2 -d "$passfile" | + $age -R "$basedir/recipients" -o "$PA_DIR/$name.age" && printf '%s\n' "Saved '$name' to the store." done
M
contrib/pa-rekey
→
contrib/pa-rekey
@@ -25,26 +25,29 @@
realstore=$(realpath "$PA_DIR") || die "Couldn't get path to password directory" -mkdir "$basedir/tmp" || +tmpdir=$basedir/tmp + +mkdir "$tmpdir" || die "Couldn't create temporary directory" -trap 'rm -rf "$basedir/tmp"; exit' EXIT -trap 'rm -rf "$basedir/tmp"; trap - INT; kill -s INT 0' INT +trap 'rm -rf "$tmpdir"; exit' EXIT +trap 'rm -rf "$tmpdir"; trap - INT; kill -s INT 0' INT -cp -Rp "$realstore" "$basedir/tmp/passwords" || +cp -Rp "$realstore" "$tmpdir/passwords" || die "Couldn't copy password directory" # Remove git repository for forward secrecy. -rm -rf "$basedir/tmp/passwords/.git" +rm -rf "$tmpdir/passwords/.git" -[ "$PA_IDENTITIES" ] && cp "$PA_IDENTITIES" "$basedir/tmp/identities" -[ "$PA_RECIPIENTS" ] && cp "$PA_RECIPIENTS" "$basedir/tmp/recipients" +[ "$PA_IDENTITIES" ] && cp "$PA_IDENTITIES" "$tmpdir/identities" +[ "$PA_RECIPIENTS" ] && cp "$PA_RECIPIENTS" "$tmpdir/recipients" -$age_keygen >>"$basedir/tmp/identities" 2>/dev/null -$age_keygen -y "$basedir/tmp/identities" >>"$basedir/tmp/recipients" 2>/dev/null +$age_keygen >>"$tmpdir/identities" 2>/dev/null +$age_keygen -y "$tmpdir/identities" >>"$tmpdir/recipients" 2>/dev/null -pa list | while read -r name; do - pa show "$name" | $age -R "$basedir/tmp/recipients" -o "$basedir/tmp/passwords/$name.age" || +pa l | while read -r name; do + pa s "$name" | + $age -R "$tmpdir/recipients" -o "$tmpdir/passwords/$name.age" || die "Couldn't encrypt $name.age" done@@ -53,10 +56,10 @@
rm -rf "$realstore" || die "Couldn't remove password directory" -mv "$basedir/tmp/passwords" "$realstore" -mv "$basedir/tmp/identities" "$(realpath "$basedir/identities")" -mv "$basedir/tmp/recipients" "$(realpath "$basedir/recipients")" -rmdir "$basedir/tmp" +mv "$tmpdir/passwords" "$realstore" +mv "$tmpdir/identities" "$(realpath "$basedir/identities")" +mv "$tmpdir/recipients" "$(realpath "$basedir/recipients")" +rmdir "$tmpdir" # Recreate git repository if needed. -pa list >/dev/null +pa l >/dev/null
M
contrib/pa-rofi
→
contrib/pa-rofi
@@ -4,6 +4,6 @@ # prompt for a password via rofi
# generate new password if it doesn't exist # then type the selected password via xdotool -name=$(pa list | rofi -dmenu -i "$@") || exit -{ pa show "$name" || { printf y | pa add "$name" >/dev/null && pa show "$name"; }; } | +name=$(pa l | rofi -dmenu -i "$@") || exit +{ pa s "$name" || { printf y | pa a "$name" >/dev/null && pa s "$name"; }; } | head -n 1 | tr -d '\n' | xdotool type --clearmodifiers --file -