Skip to content

Instantly share code, notes, and snippets.

@phrawzty
Created September 18, 2025 09:03
Show Gist options
  • Select an option

  • Save phrawzty/05f9f5825a50c1f050d226cbff8c57fe to your computer and use it in GitHub Desktop.

Select an option

Save phrawzty/05f9f5825a50c1f050d226cbff8c57fe to your computer and use it in GitHub Desktop.
Quick script to display site and username from jq output, then pipe the password to pbcopy. This is handy since it avoids multiple calls to the bw bin (and thus multiple password prompts).
#!/usr/bin/env zsh
# This just uses jq to output the site name, username, and password.
# Functional but exposes the password.
#bw list items --search ${1} | jq '.[] | {name: .name, username: .login.username, password: .login.password}'
# This will output the site name and username, but not the password; instead,
# the password is piped directly to pbcopy so it isn't exposed visually.
bw list items --search ${1} | jq -r '.[] | .login.password, "---", "name: \(.name)\nusername: \(.login.username)"' | { read -r pass; read -r sep; cat; echo "$pass" | pbcopy; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment