#!/usr/bin/env ysh proc main(...args) { var subcommand = args[0] shift 1 case (subcommand) { passphrase { gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1 } password { gopass pwgen --symbols --one-per-line @[args] | head -n1 } secret { dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 } encode-argon2 { write -- $[args[1]] | argon2 $(openssl rand -base64 32) -e -id -k 65540 -t 3 -p 4 } (else) { echo "Invalid subcommand: '$[arg1]'." 1>&2 exit 1 } } } if is-main { main @ARGV }