Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (20 sloc) 486 Bytes
#!/bin/bash
function require(){
PROGRAM="$1"
ALTERNATIVE="$2"
if command -v $PROGRAM >/dev/null 2>&1; then
echo $PROGRAM
return
else
if command -v $ALTERNATIVE >/dev/null 2>&1; then
echo $ALTERNATIVE;
else
echo "Missing required program: $PROGRAM"
exit 1
fi
fi
}
VAULT=$(require vault)
COPY=$(require pbcopy "xsel -b")
SERVICE=${1:? "Usage: $0 SERVICE_NAME"}
$VAULT -p $SERVICE | $COPY