Skip to content

Instantly share code, notes, and snippets.

@gcastillo-ucsd
Forked from justinline/1password clipboard
Created November 15, 2023 01:50
Show Gist options
  • Select an option

  • Save gcastillo-ucsd/a73638074807c2ad77886ede9950b2f1 to your computer and use it in GitHub Desktop.

Select an option

Save gcastillo-ucsd/a73638074807c2ad77886ede9950b2f1 to your computer and use it in GitHub Desktop.
1password command line clipboard copying
# 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
@gcastillo-ucsd
Copy link
Author

Saving for future use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment