Last active
November 7, 2024 00:06
-
-
Save justinline/e11ac0f08f267502b9e96362457d03c6 to your computer and use it in GitHub Desktop.
1password command line clipboard copying
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
# Short alias to allow automated copying of the 1password cli tool command 'op get somewebsite | jq ...' and then a timed clear on the gnome clipboard | |
# TODO: specify designation as an argument and maybe a command to open the website in chrome | |
pass=$(op get item $1 | jq -r '.details.fields[] | select(.designation=="password").value') | |
if [ -n "$pass" ] | |
then | |
echo $pass | xclip -selection clipboard | |
echo "Password was copied - clipboard will be wiped in 15 seconds" | |
sleep 15 | |
echo "" | xclip -selection clipboard | |
echo "Clipboard reset." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a version that works for Mac and: