summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/password-store.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 0aa5787..fe21e19 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -263,8 +263,22 @@ cmd_init() {
fi
fi
- mkdir -v -p "$PREFIX/$id_path"
local gpg_id="$PREFIX/$id_path/.gpg-id"
+
+ if [[ $# -eq 1 && -z $1 ]]; then
+ if [[ ! -f "$gpg_id" ]]; then
+ echo "Error: $gpg_id does not exist and so cannot be removed."
+ exit 1
+ fi
+ rm -v -f "$gpg_id" || exit 1
+ if [[ -d $GIT_DIR ]]; then
+ git rm -qr "$gpg_id"
+ git_commit "Deinitialized ${gpg_id}."
+ fi
+ exit 0
+ fi
+
+ mkdir -v -p "$PREFIX/$id_path"
printf "%s\n" "$@" > "$gpg_id"
local id_print="$(printf "%s, " "$@")"
echo "Password store initialized for ${id_print%, }"
others/pass.git/commit/tests/t0060-rm-tests.sh?h=1.6.5&id=84f5cffec908479ac0c32d66839aca5a8b0503ec&follow=1'>tests: test for spacesJason A. Donenfeld3-8/+20 2014-04-24Move test instructions to INSTALL.Jason A. Donenfeld2-11/+18 2014-04-24tests: we don't use aggregate-resultsJason A. Donenfeld1-57/+0 2014-04-24Don't prompt for questions when stdin is not a tty.Jason A. Donenfeld3-7/+6 2014-04-24Allow overridable bash.Jason A. Donenfeld16-16/+16 2014-04-24dmenu: check for empty instead of ret codeJason A. Donenfeld1-1/+1 2014-04-24tests: sed doesn't like escaped chars on non-gnuJason A. Donenfeld1-1/+1 2014-04-24tests: run from anywhereJason A. Donenfeld13-4/+16 2014-04-24Turns out aliases were a bad idea.Jason A. Donenfeld14-95/+92 2014-04-24Make gpg_opts an array.Jason A. Donenfeld1-12/+12 2014-04-24Shellcheck errors.Jason A. Donenfeld1-6/+6 2014-04-24tests: todo updateJason A. Donenfeld1-25/+0