For those using 1password to manage their passwords,there is 1password command-line tool to script the retrieve of your passwords.
Here I'll just share some useful commands to script your password manager.
Requirements:
Log in
login() {
eval $(op signin my)
}
Log out
login() {
op signout
}
Retrieve password
To retrieve with jq a password from sections details or field details:
echo "$(op get item MyITEM --vault MyTeamVAULT | jq -r 'if .details.sections[0] == null then .details.fields[] |select(.designation=="password").value else .details.sections[].fields[] | select((.n=="password") or (.t=="Password")).v end'
You can modify this command to retrieve other fields than password.
P.S. jq could be used with curl to parse JSON result and do some interesting scripting tasks.
Have fun
:)
Top comments (0)