aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2025-07-16 21:58:20 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2025-07-16 21:58:20 -0400
commitd648fba27d8381aea373d80b805d011ccd5ee554 (patch)
tree5b7ab8dc29b904dfcbc2b4eb1c9e71be7d1f3dcd
parentUse clang-format for c and cpp (diff)
downloaddotfiles-d648fba27d8381aea373d80b805d011ccd5ee554.zip
ADd get password script
-rwxr-xr-xexecutables/bin/get-password36
1 files changed, 36 insertions, 0 deletions
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 <name>] --credential <name>"
+ exit 1
+ ;;
+ esac
+ done
+
+ if [ -z "$CREDENTIAL" ]; then
+ echo "Invalid or empty CREDENTIAL" >&2
+ exit 1
+ fi
+}
+
+main "$@"