From d3e5432e003c5a2ea9849b3e80706ec2cb1a013a Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 2 Dec 2026 18:54:14 -0800 Subject: Add bin dir --- bin/get-password | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/get-password (limited to 'bin/get-password') diff --git a/bin/get-password b/bin/get-password new file mode 100755 index 0000000..67c07e7 --- /dev/null +++ b/bin/get-password @@ -0,0 +1,37 @@ +#!/bin/sh +set -o errexit +set -o nounset + +VAULT="Private" +CREDENTIAL="" + +main() { + parse_args "$@" + op read "op://$VAULT/$CREDENTIAL/password" +} + +parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + --vault) + VAULT="$2" + shift 2 + ;; + --credential) + CREDENTIAL="$2" + shift 2 + ;; + *) + echo "Usage: $0 [--vault ] --credential " + exit 1 + ;; + esac + done + + if [ -z "$CREDENTIAL" ]; then + echo "Invalid or empty CREDENTIAL" >&2 + exit 1 + fi +} + +main "$@" -- cgit v1.2.3