summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:38:52 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:38:52 +0200
commit0f0483f789e4819b029cf2f9d8168a6172da4d92 (patch)
tree18822a6ea497e2fcd000f482346e9e2753b818e3
parent04ff6261ca172aceb09bad926da68c41ba17b78e (diff)
downloadpass-0f0483f789e4819b029cf2f9d8168a6172da4d92.tar.gz
pass-0f0483f789e4819b029cf2f9d8168a6172da4d92.tar.bz2
pass-0f0483f789e4819b029cf2f9d8168a6172da4d92.zip
init: allow deinitialization
-rw-r--r--man/pass.14
-rwxr-xr-xsrc/password-store.sh16
2 files changed, 18 insertions, 2 deletions
diff --git a/man/pass.1 b/man/pass.1
index 2f3b311..35c81ee 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -63,7 +63,9 @@ Note that use of
is recommended so that the batch decryption does not require as much user
intervention. If \fI--path\fP or \fI-p\fP is specified, along with an argument,
a specific gpg-id or set of gpg-ids is assigned for that specific sub folder of
-the password store.
+the password store. If only one \fIgpg-id\fP is given, and it is an empty string,
+then the current \fI.gpg-id\fP file for the specified \fIsub-folder\fP (or root if
+unspecified) is removed.
.TP
\fBls\fP \fIsubfolder\fP
List names of passwords inside the tree at
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%, }"
-1/+1 2007-05-13Add commitdiff between commit and each of it's parentLars Hjemli5-10/+63 2007-05-13Add graphical diffstat to commit viewLars Hjemli5-33/+130 2007-05-13Add max-commit-count parameter to cgitrcLars Hjemli4-2/+10 2007-05-13Show number of changed lines in log viewLars Hjemli1-1/+11 2007-05-13Simplify ui-diff.c using the new file-level diff interfaceLars Hjemli1-86/+2 2007-05-13Add standard interface for file diff functionsLars Hjemli2-0/+86 2007-05-13Show number of changed files in log viewLars Hjemli1-2/+15 2007-05-13Use standard tree-diff function when showing diffstat for single commitLars Hjemli1-51/+15 2007-05-13Add shared diff-handling functionsLars Hjemli2-2/+50 2007-05-12css: fix bad rendering in Internet ExplorerLars Hjemli1-2/+7 2007-05-11Add links to enable downloading of tagged blobsLars Hjemli2-9/+85 2007-05-11Makefile: add support for building w.o. preinstalled gitLars Hjemli1-1/+13 2007-05-11Tag release v0.3v0.3Lars Hjemli1-1/+1 2007-05-11Update README with submodule build infoLars Hjemli1-13/+39 2007-05-11Add submodule links in tree listingLars Hjemli6-12/+27 2007-05-11Add submodules.sh and use it during buildsLars Hjemli3-13/+222 2007-05-11Added git as a submoduleLars Hjemli2-1/+1 2007-05-09Add support for downloading single blobsLars Hjemli5-3/+47 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli3-5/+10 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli9-837/+50 2007-02-21Layout updateLars Hjemli9-32/+127 2007-02-08Make snapshot feature configurableLars Hjemli5-6/+22 2007-02-08Add support for snapshotsLars Hjemli8-8/+153 2007-02-05cgit v0.2v0.2Lars Hjemli1-1/+1 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli2-15/+37 2007-02-04Update cgitrc templateLars Hjemli1-21/+32 2007-02-04Add support for lightweight tagsLars Hjemli2-19/+37 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli5-55/+120 2007-02-04Do not die if tag has no messageLars Hjemli1-2/+2 2007-02-03Fix search for non-virtual urlsLars Hjemli1-0/+6 2007-01-28Update README with install/config informationLars Hjemli1-24/+28