-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpass.plugin.zsh
executable file
·45 lines (38 loc) · 1.03 KB
/
pass.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Ensure pass is available
if (( ! ${+commands[pass]} )); then
return 1
fi
function __fzfsh_pass() {
local pass_dir="$HOME/.password-store"
fd --type=file .gpg "$pass_dir" | sed "s|^$pass_dir/||;s|.gpg$||" | fzf
}
function fzfsh::pass::clip() {
local entry=${1:-$(__fzfsh_pass)}
[[ -z "$entry" ]] && return 1
pass --clip "$entry"
}
function fzfsh::pass::edit() {
local entry=${1:-$(__fzfsh_pass)}
[[ -z "$entry" ]] && return 1
pass tailedit "$entry"
}
function fzfsh::pass::otp() {
local entry=${1:-$(__fzfsh_pass)}
[[ -z "$entry" ]] && return 1
pass otp -c "$entry"
}
function fzfsh::pass::show() {
local entry=${1:-$(__fzfsh_pass)}
[[ -z "$entry" ]] && return 1
pass show "$entry" | bat --language=yaml --paging=always
}
function fzfsh::pass::update() {
local entry=${1:-$(__fzfsh_pass)}
[[ -z "$entry" ]] && return 1
pass update -E "$entry"
}
alias pclip='fzfsh::pass::clip'
alias pedit='fzfsh::pass::edit'
alias potp='fzfsh::pass::otp'
alias pshow='fzfsh::pass::show'
alias pupdate='fzfsh::pass::update'