Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetching passwords and TOTPs from vault #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Anthirian
Copy link

Recently I've been having issues with autotype and copy to clipboard using the plugin. I found that in some shells using the echo pass,<entry> and echo totp,<entry> --bind commands in a subshell did not populate the script variables correctly. I've opted for using the --expect flag to fzf, which always prints the key pressed to select the entry along the entry itself. Then, using readarray this is split into the correct variables again.

@tomoakley
Copy link

tomoakley commented Feb 28, 2025

I've had the same problem - I tried your fork, but still has the same problem. Debugging it, I can see the $selection array is empty. I'm on macOS 15.3.1 - will try and find a fix

@@ -48,27 +47,29 @@ main() {
items="$(op::get_all_items)"
spinner::stop

selected_item="$(echo "$items" | awk -F ',' '{ print $1 }' | fzf "${fzf_opts[@]}")"
readarray -t selection <<< "$(echo "$items" | awk -F ',' '{ print $1 }' | fzf "${fzf_opts[@]}")"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to work better for me:

  IFS=$'\n' read -r -d '' -a selection < <(echo "$items" | awk -F ',' '{ print $1 }' | fzf "${fzf_opts[@]}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants