summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/password-store.sh')
-rwxr-xr-xsrc/password-store.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 2488385..76c7385 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -37,9 +37,10 @@ Usage:
$program [show] [--clip,-c] pass-name
Show existing password and optionally put it on the clipboard.
If put on the clipboard, it will be cleared in 45 seconds.
- $program insert [--no-echo,-n | --multiline,-m] pass-name
+ $program insert [--no-echo,-n | --multiline,-m] [--force,-f] pass-name
Insert new password. Optionally, the console can be enabled to not
- echo the password back. Or, optionally, it may be multiline.
+ echo the password back. Or, optionally, it may be multiline. Prompt
+ before overwriting existing password unless forced.
$program edit pass-name
Insert a new password or edit an existing password using ${EDITOR:-vi}.
$program generate [--no-symbols,-n] [--clip,-c] pass-name pass-length
@@ -170,24 +171,26 @@ case "$command" in
insert)
ml=0
noecho=0
+ force=0
- opts="$(getopt -o mn -l multiline,no-echo -n $program -- "$@")"
+ opts="$(getopt -o mnf -l multiline,no-echo,force -n $program -- "$@")"
err=$?
eval set -- "$opts"
while true; do case $1 in
-m|--multiline) ml=1; shift ;;
-n|--no-echo) noecho=1; shift ;;
+ -f|--force) force=1; shift ;;
--) shift; break ;;
esac done
if [[ $err -ne 0 || ( $ml -eq 1 && $noecho -eq 1 ) || $# -ne 1 ]]; then
- echo "Usage: $program $command [--no-echo,-n | --multiline,-m] pass-name"
+ echo "Usage: $program $command [--no-echo,-n | --multiline,-m] [--force,-f] pass-name"
exit 1
fi
path="$1"
passfile="$PREFIX/$path.gpg"
- if [[ -e $passfile ]]; then
+ if [[ $force -eq 0 && -e $passfile ]]; then
prompt="An entry already exists for $path. Overwrite it [y/N]? "
read -p "$prompt" yesno
[[ $yesno == "y" || $yesno == "Y" ]] || exit 1
ref='/others/pass.git/tag/?h=1.6.2'>1.6.2Jason A. Donenfeld1-1/+1 2014-05-14Don't define tmpdir on git init.Jason A. Donenfeld1-4/+3 2014-05-14Disable secmem warning when discovering keysmilki2-2/+2 2014-05-10edit: Quote editor so tests work in spaced directories.Jason A. Donenfeld1-1/+1 2014-05-10reencryption: Properly escape input to sedJason A. Donenfeld1-1/+1 2014-05-10git: use secure tmp directoryJason A. Donenfeld1-4/+11 2014-05-10configure git to decrypt gpg files automaticallySamuel Le Thiec1-0/+5 2014-05-08completion: add new generate flagsJason A. Donenfeld3-2/+7 2014-05-08inplace: mutually exclusive with forceJason A. Donenfeld2-3/+3 2014-05-08usage: tab to spacesJason A. Donenfeld1-1/+1 2014-05-08generate: use nice ansi colors instead.Jason A. Donenfeld1-3/+2 2014-05-08zsh: posix compatible sed fix for zsh-completionJason A. Donenfeld1-1/+1 2014-05-07Implement interactive init functionSvend Sorensen1-0/+8 2014-05-07Implement interactive rename functionSvend Sorensen1-0/+7 2014-05-07Reorder interactive function to match order of helper functionsSvend Sorensen1-13/+13 2014-05-07Make edit helper function name consistent with other helpersSvend Sorensen1-1/+1 2014-05-07Factor out password completing-read functionSvend Sorensen1-4/+8 2014-05-07Add dash to Package-RequiresSvend Sorensen1-1/+1 2014-05-06Force sane sort order.Jason A. Donenfeld1-2/+2 2014-05-06generate: add --in-place optionJason A. Donenfeld4-9/+33