aboutsummaryrefslogtreecommitdiffstats
path: root/executables
diff options
context:
space:
mode:
Diffstat (limited to 'executables')
-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 "$@"