Skip to content

Instantly share code, notes, and snippets.

@karronoli
Created March 28, 2021 09:47
Show Gist options
  • Save karronoli/e345de6606bd8435540cc01e86e9a835 to your computer and use it in GitHub Desktop.
Save karronoli/e345de6606bd8435540cc01e86e9a835 to your computer and use it in GitHub Desktop.
`PASSWORD_STORE_ENABLE_EXTENSIONS=true pass wsl show -c path/to/password` on WSL
clip() {
local sleep_argv0="password store sleep on display $DISPLAY"
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
echo -n "$1" | clip.exe || die "Error: Could not copy data to the clipboard"
(
( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
echo -n | clip.exe
) >/dev/null 2>&1 & disown
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}
case "$1" in
init) shift; cmd_init "$@" ;;
help|--help) shift; cmd_usage "$@" ;;
version|--version) shift; cmd_version "$@" ;;
show|ls|list) shift; cmd_show "$@" ;;
find|search) shift; cmd_find "$@" ;;
grep) shift; cmd_grep "$@" ;;
insert|add) shift; cmd_insert "$@" ;;
edit) shift; cmd_edit "$@" ;;
generate) shift; cmd_generate "$@" ;;
delete|rm|remove) shift; cmd_delete "$@" ;;
rename|mv) shift; cmd_copy_move "move" "$@" ;;
copy|cp) shift; cmd_copy_move "copy" "$@" ;;
git) shift; cmd_git "$@" ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment