Last active
September 25, 2024 22:41
-
-
Save DepthDeluxe/15aecc68ecb42e028c96bf30cfa949e7 to your computer and use it in GitHub Desktop.
Combines the power of lastpass cli and fzf to offer an interactive fuzzy finding password experience on the command line. Lists all lastpass passwords and pipes into FZF to search by name. Once selected, the script copies desired password to the system clipboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
lpass_data=$(lpass ls) | |
if [[ "$lpass_data" == "" ]]; then | |
echo 'Error: You are likely not logged into lastpass, attempting to login' | |
exit 1 | |
fi | |
chosen_element=$(echo "$lpass_data" | fzf) | |
if [[ "$!" -eq 0 ]]; then | |
chosen_element_id=$(echo "$chosen_element" | egrep -o 'id: [0-9]+' | awk '{ print $2; }') | |
echo "Chose id: $chosen_element_id" | |
lpass show --password --clip "$chosen_element_id" | |
else | |
echo 'Cancelled operation...' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made some tweaks