-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc_pass
39 lines (35 loc) · 1.36 KB
/
bashrc_pass
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
#!/bin/bash
return # XXX: old code, don't use anything on this file
function _pass_wait_to_void_clipboard {
trap '' SIGINT
read -s -t ${PASS_CLIPBOARD_TIME:-20} -p "press enter to continue"; echo
echo -n "void" | xclip -sel clip
echo "clipboard cleared"
trap SIGINT
}
function pass {
if [[ -z "$1" ]]; then
echo "missing name" >&2
return
fi
pass=$(${PASS_ESTORE_COMMAND:-estore} -rs -p "passwords/$1") || return
echo -n "$pass" | xclip -sel clip
echo; echo "--------------------------------------------------------------------------------";
echo -e "\e[1;36mpassword '$1' copied to clipboard for ${PASS_CLIPBOARD_TIME:-20} seconds\e[0m"
echo "--------------------------------------------------------------------------------"; echo;
_pass_wait_to_void_clipboard
}
function pass-gen {
if [[ -z "$1" ]]; then
echo "missing name" >&2
return
fi
pass=$(pwgen -sy1 32) || return
${PASS_ESTORE_COMMAND:-estore} -rs -p "passwords/$1" -s "$pass" || return
echo -n "$pass" | xclip -sel clip
echo; echo "--------------------------------------------------------------------------------";
echo -e "\e[1;32mgenerated and stored a new password\e[0m"
echo -e "\e[1;36mpassword '$1' copied to clipboard for ${PASS_CLIPBOARD_TIME:-20} seconds\e[0m"
echo "--------------------------------------------------------------------------------"; echo;
_pass_wait_to_void_clipboard
}