spm

Personal fork of spm (simple password manager)

commit 63ad458e6e031c585f9ebc86de2d0abbc0214cf9
parent 3b43ce5322903886e10f58226cb91a5c0c135607
Author: Klemens Nanni <kl3@posteo.org>
Date: Thu, 30 Jun 2016 11:41:45 +0200

Remove colors from 'search', add example to manpage

In case colors are desired, simply use spm in combination with grep(1)
or similar:

	pwsearch() {
		spm search "${1}" | grep --color=always "${1}"
	}
2 files changed, 6 insertions(+), 6 deletions(-)
M
README.pod
|
4
++++
M
spm.sh
|
8
++------
diff --git a/README.pod b/README.pod
@@ -108,6 +108,10 @@ List groups only:
 
 	$ spm list -g
 
+Show all entries matching the pattern 'sys':
+
+	$ spm search sys
+
 =head1 SEE ALSO
 
 git(1), gpg2(1), ln(1), pwgen(1), tpm(1), xclip(1)
diff --git a/spm.sh b/spm.sh
@@ -49,8 +49,7 @@ readpw() {
 }
 
 _search() {
-	find "${STORE_DIR}"/ \( -type f -o -type l \) \
-		-iwholename "*${1}*".gpg
+	find "${STORE_DIR}"/ \( -type f -o -type l \) -iwholename "*${1}*".gpg
 }
 
 view() {

@@ -85,10 +84,7 @@ del() {
 }
 
 search() {
-	_search "${1}" \
-		| sed "s^${STORE_DIR}/;
-		       s${1}\x1B\[01;31m${1}\x1B[00mg" \
-		| view
+	_search "${1}" | view
 }
 
 show() {