diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-12-02 18:54:14 -0800 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-12-02 18:54:14 -0800 |
| commit | d3e5432e003c5a2ea9849b3e80706ec2cb1a013a (patch) | |
| tree | 42e8c09d0fa8bf33742a367875bbf685ea84ebfe /bin/get-password | |
| parent | Add simple readme (diff) | |
| download | dotfiles-d3e5432e003c5a2ea9849b3e80706ec2cb1a013a.zip | |
Add bin dir
Diffstat (limited to '')
| -rwxr-xr-x | bin/get-password | 37 |
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 "$@" |