Commit Diff


commit - c6219afad3b2d97a4b4a23f4493edd1b5fc77467
commit + f64694c19c232ce19b36250f7da873f7715076eb
blob - fc5935599a009ad4e41a820ee16eb1676a58d3af
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
@@ -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
 }
@@ -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