1 if (( ! $+commands[rbw] )); then
5 # If the completion file doesn't exist yet, we need to autoload it and
6 # bind it to `rbw`. Otherwise, compinit will have already done that.
7 if [[ ! -f "$ZSH_CACHE_DIR/completions/_rbw" ]]; then
13 rbw gen-completions zsh >| "$ZSH_CACHE_DIR/completions/_rbw" &|
15 # rbwpw function copies the password of a service to the clipboard
16 # and clears it after 20 seconds
18 if [[ $# -ne 1 ]]; then
19 echo "usage: rbwpw <service>"
27 local pw=$(rbw get $service 2>/dev/null)
29 echo "$service not found"
32 echo -n $pw | clipcopy
33 echo "password for $service copied!"
34 {sleep 20 && clipcopy </dev/null 2>/dev/null} &|
39 services=("${(@f)$(rbw ls 2>/dev/null)}")
40 [[ -n "$services" ]] && compadd -a -- services