Last active
March 5, 2017 13:03
-
-
Save agarzola/46f45116eb1ff5049edf25ba41c10c9b to your computer and use it in GitHub Desktop.
Shortcuts to my most used lpass commands
This file contains 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
function lastpass () { | |
if [ "$1" ]; then | |
if [ "$2" ]; then | |
if [ "$1" = "all" ] || [ "$1" = "password" ] || [ "$1" = "username" ] || [ "$1" = "url" ] || [ "$1" = "notes" ]; then | |
requested_part="$1" | |
else | |
requested_part="field=$1" | |
fi | |
requested_account="$2" | |
else | |
requested_part=password | |
requested_account="$1" | |
fi | |
lpass show --clip --$requested_part $requested_account && printf "${requested_part//field=/} copied to clipboard\n"; | |
else | |
printf "Copy lastpass fields to your clipboard.\nUsage: takes one or two arguments —\n 1. an optional field name (defaults to password)\n 2. an account name\n\n e.g. lastpass username github\n ⮑ github username is copied to your clipboard\n\n lastpass github\n ⮑ github password is copied to your clipboard\n"; | |
fi | |
} | |
function findpass () { | |
if [ "$1" ]; then | |
lpass ls | grep $1 | |
else | |
printf "List lastpass accounts matching your query.\nUsage: one argument — a query\n\n e.g. findpass git\n ⮑ list of accounts stored in lastpass that match \`git\`\n"; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment