Skip to content

Instantly share code, notes, and snippets.

@cherryramatisdev
Created August 28, 2023 13:36
Show Gist options
  • Select an option

  • Save cherryramatisdev/e4606fec67f16d7d5a1a0e33e4ef3697 to your computer and use it in GitHub Desktop.

Select an option

Save cherryramatisdev/e4606fec67f16d7d5a1a0e33e4ef3697 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
passwords=$(bw list items | jq '.[] | {id: .id, name: .name}')
selected_password=$(echo "$passwords" | jq -r '.name' | fzf)
selected_password_id=$(echo "$passwords" | jq "select(.name == \"$selected_password\").id" | tr -d '"')
password=$(bw get item "$selected_password_id")
if [[ "$password" != "" ]]; then
echo "Copied password from $selected_password with $(echo "$password" | jq '.login.username') username to clipbord..."
echo "$password" | jq '.login.password' | tr -d '"' | pbcopy
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment