From d648fba27d8381aea373d80b805d011ccd5ee554 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 16 Jul 2025 21:58:20 -0400 Subject: ADd get password script --- executables/bin/get-password | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 executables/bin/get-password (limited to 'executables/bin/get-password') diff --git a/executables/bin/get-password b/executables/bin/get-password new file mode 100755 index 0000000..ca13d93 --- /dev/null +++ b/executables/bin/get-password @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +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