[NixOS] Add passgen

This commit is contained in:
2026-01-22 01:10:15 -08:00
parent b9f4a8731e
commit aecc7afb4c

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env sh
function passgen {
if [ -z "$1" ]; then
echo "Usage: passgen <pass-entry-name>" >&2
return 1
fi
local base_pass upper symbol password
base_pass="$(xkcdpass -n 3 | tr -d ' ')"
upper="$(echo {A..Z} | tr ' ' '\n' | shuf -n1)"
symbol="$(echo '!@#$%^&*' | fold -w1 | shuf -n1)"
password="${base_pass}${upper}${symbol}"
echo "$password" | pass insert -e "$1"
}
passgen