aboutsummaryrefslogtreecommitdiffstats
path: root/bin/get-password
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-12-02 18:54:14 -0800
committerEugene Triguba <hello@eugenetriguba.com>2026-12-02 18:54:14 -0800
commitd3e5432e003c5a2ea9849b3e80706ec2cb1a013a (patch)
tree42e8c09d0fa8bf33742a367875bbf685ea84ebfe /bin/get-password
parentAdd simple readme (diff)
downloaddotfiles-d3e5432e003c5a2ea9849b3e80706ec2cb1a013a.zip
Add bin dir
Diffstat (limited to 'bin/get-password')
-rwxr-xr-xbin/get-password37
1 files changed, 37 insertions, 0 deletions
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 <name>] --credential <name>"
+ exit 1
+ ;;
+ esac
+ done
+
+ if [ -z "$CREDENTIAL" ]; then
+ echo "Invalid or empty CREDENTIAL" >&2
+ exit 1
+ fi
+}
+
+main "$@"