blob: 7bf173d1e5163ff83ae2f027af179c8ab6f4582d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env bash
#
# List keys, tree version.
#
# 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" maintenance $* || exit 1
# Aditional parameters
CWD="`pwd`"
# Avoid leading slash
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/$RELATIVE_PATH" && $TREE $ARGS
cd "$CWD"
|