Refactoring install

This commit is contained in:
2026-03-15 16:24:30 +00:00
parent 10939f2ea3
commit b3637e4d6f
19 changed files with 234 additions and 88 deletions

View File

@@ -0,0 +1,28 @@
#! /bin/zsh
local label="$1"
if [[ -z "$MASTERPW" ]]; then
export MASTERPW=$(gum input --password --placeholder "Enter Enpass Master Password")
fi
local entry=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -json -sort show "$label" | sed 's/\\/\\\\/g') # Escaping backslashes for jq
len=$(echo "$entry" | jq '. | length')
if [[ $len -eq 0 ]]; then
exit 1
fi
if [[ $len -gt 1 ]];then
logins=$(echo "$entry" | jq -r '.[].login')
login=$(echo "$logins" | gum choose --header "Select which account to use" --selected="stofflees@gmail.com" --height=$(echo "$logins" | wc -l) --ordered)
entry=$(echo "$entry" | jq -c --arg login "$login" '.[] | select(.login == $login) | [.]')
fi
username=$(echo "$entry" | jq -r '.[].login')
password=$(echo "$entry" | jq -r '.[].password')
if [[ -z "$username" || -z "$password" ]]; then
exit 1
fi
echo "$username $password"