summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2012-09-13 16:35:49 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-09-13 16:35:49 +0200
commitb718c8039e5a04f102c3d2bb9f920d1472c89da1 (patch)
tree918aeeb4822a951715b62b7267b0475ba9432360 /src/password-store.sh
parent709808d22cf09390b5404b7bfc42f3243d9577d4 (diff)
downloadpass-b718c8039e5a04f102c3d2bb9f920d1472c89da1.tar.gz
pass-b718c8039e5a04f102c3d2bb9f920d1472c89da1.tar.bz2
pass-b718c8039e5a04f102c3d2bb9f920d1472c89da1.zip
Allow avoiding the prompt for overwriting, with --force flag.
Diffstat (limited to '')
-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
/portato.git/commit/portato/gui/exception_handling.py?id=657ca163ea9fc4992c004b8b7daf33a72b6e571a&follow=1'>Removed lxml version in error stringRené 'Necoro' Neumann1-2/+1 2008-07-04Removed lxml version in error stringRené 'Necoro' Neumann1-3/+1 2008-07-04Ignore errors on plugin loadingRené 'Necoro' Neumann1-0/+6 2008-07-04Added ability to install missing plugin depsRené 'Necoro' Neumann3-95/+126 2008-07-04Fixed find_best_match for <portage-2.1.5René 'Necoro' Neumann1-2/+2 2008-07-04Some more dependency awarenessRené 'Necoro' Neumann5-23/+59 2008-07-03Some window refinementRené 'Necoro' Neumann1-109/+126 2008-07-03Removed XSD_LOCATION -- as there is no more xsd ;)René 'Necoro' Neumann2-5/+1 2008-07-03Updated setup.py to install the correct set of pluginsRené 'Necoro' Neumann1-3/+2 2008-07-03Ported etc-proposals pluginRené 'Necoro' Neumann3-50/+43 2008-07-03Ported gpytage pluginRené 'Necoro' Neumann2-16/+14 2008-07-03Ported Notify pluginRené 'Necoro' Neumann4-37/+51 2008-07-03Remove xsd and -x cmdline optionRené 'Necoro' Neumann2-107/+1 2008-07-03Ported completelyRené 'Necoro' Neumann3-548/+54 2008-07-03Should show dependencies nowRené 'Necoro' Neumann2-82/+128 2008-07-03Use __slots__ for the PkgData class to save memoryRené 'Necoro' Neumann1-2/+3 2008-07-03New plugin system - first hackRené 'Necoro' Neumann2-420/+683 2008-06-30Now the new design is able to do the same as the old oneRené 'Necoro' Neumann3-168/+182 2008-06-30First draft of the new plugin windowRené 'Necoro' Neumann1-8/+172 2008-06-30Added stuff to plugin.pyRené 'Necoro' Neumann1-2/+24 2008-06-30Beautified some dialogsRené 'Necoro' Neumann1-6/+8 2008-06-30Only add a package to mergequeue if everything went fineRené 'Necoro' Neumann1-1/+1 2008-06-26Removed '__find_resolved_unresolved' as it is quite useless.René 'Necoro' Neumann3-53/+29 2008-06-26Added very basic set queryingRené 'Necoro' Neumann3-0/+27 2008-06-25Now load 22 versions when running the correct portageRené 'Necoro' Neumann4-8/+18 2008-06-25Added Package_22 and System_22René 'Necoro' Neumann4-5/+63