summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/keyringer/actions/tree14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree
index 2033abd..8e94cb0 100755
--- a/lib/keyringer/actions/tree
+++ b/lib/keyringer/actions/tree
@@ -3,6 +3,11 @@
# List keys.
#
+# Thanks http://www.centerkey.com/tree/
+function keyringer_tree {
+ ls -R $* | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
+}
+
# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
@@ -14,6 +19,13 @@ CWD="`pwd`"
shift
ARGS="`echo "$*" | sed -e "s|^/*||"`"
+# Check implementation
+if which tree &> /dev/null; then
+ TREE="tree"
+else
+ TREE="keyringer_tree"
+fi
+
# Run list command
-cd "$KEYDIR" && tree $ARGS
+cd "$KEYDIR" && $TREE $ARGS
cd "$CWD"