commit c82959c56f74dd72326897f1d02bd99bc6c96f1c
parent 2327a1236a66c4def7544f64ee7d751bb2042732
Author: Klemens Nanni <kl3@posteo.org>
Date: Thu, 16 Jun 2016 01:03:42 +0200
Add basic search functionality
Diffstat:
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/README.pod b/README.pod
@@ -13,9 +13,13 @@ I<add>, I<del> or I<show> command respectively followed by a name.
spm will then prompt for a password or confirmation before it modifies
or shows the corresponding entry.
-Globbing is allowed for both I<del> and I<show> commands to avoid typing
-potentially long entry paths. In case multiple entries match, spm exits
+Basic searching is possible through the I<search> command and yields
+absoloute paths to eventually found entries.
+
+Globbing is allowed for I<del>, I<search> and I<show> to avoid typing
+potentially long entry names. In case multiple entries match, spm exits
without removing or showing any password but printing a warning instead.
+Searching will show all matching paths.
spm simply stores everything in a directory structure where passwords
correspond to individually PGP encrypted files, optionally residing
diff --git a/spm.sh b/spm.sh
@@ -96,7 +96,7 @@ show() {
&& die "Invalid number of arguments. See 'spm help'"
case "${1}" in
- add|del|show)
+ add|del|search|show)
[ -z "${2}" ] && die 'Name must not be empty'
${1} "${2}"
;;
@@ -106,7 +106,7 @@ case "${1}" in
;;
help)
cat <<- EOF
- USAGE: spm add|del|list [-g]|show|help [ENTRY|GROUP]
+ USAGE: spm add|del|list [-g]|search|show|help [ENTRY|GROUP]
See spm(1) for more information.
EOF