Commit Diff


commit - a80d4dc95ad580aae711f5ef1a62552233d86a65
commit + a17f5db3893e43db8665f629a6265aadcb19b2c2
blob - 96e7a876ed1b16b89e4146e352425db87a50ccfd
blob + c6650f20bae5f7f385a95a61a47e1263bf5edb24
--- tpm
+++ tpm
@@ -29,6 +29,7 @@ TMPDIR="/tmp"
 NUKE="rm"
 PASSWORD_STORE_KEY=${PASSWORD_STORE_KEY:-""}
 EDITOR=${EDITOR:-""}
+TOPTS="-C"
 
 ##
 # Variables r/o
@@ -51,7 +52,7 @@ usage() {
 	echo "Option can be one of the following"
 	echo
 	echo "	show <entry>		Shows password <entry>"
-	echo "	instert <entry>		Inserts new <entry>"
+	echo "	insert <entry>		Inserts new <entry>"
 	echo "	find <entry>		Searches for <entry>"
 	echo "	rm <entry>			Removes <entry>"
 	echo
@@ -166,7 +167,7 @@ insert() {
 }
 
 show_all() {
-	${TREE} -l -x --noreport -C "${STORE_DIR}" -P "*.gpg" --prune | sed 's/\.gpg//'
+	${TREE} -l -x --noreport $TOPTS "${STORE_DIR}" -P "*.gpg" --prune | sed 's/\.gpg//'
 }
 
 remove_entry() {
@@ -188,7 +189,7 @@ find_entry() {
 	local _entry_name="${1}"
 
 	[ -z "${_entry_name}" ] && abort "find needs an argument"
-	${TREE} -l -x --noreport -C "${STORE_DIR}/" -P "*${_entry_name}*" --prune \
+	${TREE} -l -x --noreport $TOPTS "${STORE_DIR}/" -P "*${_entry_name}*" --prune \
 		--matchdirs --ignore-case | sed 's/\.gpg//'
 	echo
 }
@@ -214,7 +215,7 @@ edit_entry() {
 	fi
 
 	mygpg --output "${STORE_DIR}/${_entry_name}.gpg" --encrypt ${_tmpfile} || \
-		abort "Cannot reencrypt temporary file"
+		abort "Cannot re-encrypt temporary file"
 
 	# If the file is there, remove it
 	[ -e "${_tmpfile}"  ] && ${NUKE} -f "${_tmpfile}"
@@ -226,6 +227,9 @@ edit_entry() {
 
 set +u
 [ "${1}" != "insert" -a ! -d "${STORE_DIR}" ] && abort "Password directory does not exist."
+
+# Disable colors for colortree if NO_COLOR is set
+[[ -n $NO_COLOR ]] && TOPTS="-n"
 set -u
 
 if [ ! -z "$(which colortree 2> /dev/null)" ]; then