aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrysiek <rysiek@example.org>2017-11-03 10:36:42 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-03 10:36:42 -0200
commit497a6302db1000b6b00ef708043c3f86feb14b11 (patch)
tree4d60ed9c88a1713fcaa5dd0750ba5dae6adfbb01
parent4a0d2bdc2ba611dd177454b73ebb480e15be300d (diff)
downloadkeyringer-497a6302db1000b6b00ef708043c3f86feb14b11.tar.gz
keyringer-497a6302db1000b6b00ef708043c3f86feb14b11.tar.bz2
keyringer_tree fixed on FreeBSD; also, prettier everywhere else
-rwxr-xr-xlib/keyringer/actions/tree7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree
index 7bf173d..a877548 100755
--- a/lib/keyringer/actions/tree
+++ b/lib/keyringer/actions/tree
@@ -5,7 +5,7 @@
# Thanks http://www.centerkey.com/tree/
function keyringer_tree {
- ls -R $* | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
+ find $* | sed -e 's/[^-][^\/]*\//| /g' | sed -r -e 's/\| ([^|])/|- \1/'
}
# Load functions
@@ -19,6 +19,11 @@ CWD="`pwd`"
shift
ARGS="`echo "$*" | sed -e "s|^/*||"`"
+# on *BSD, find expects at least one argument with the path
+if [ "$ARGS" == "" ]; then
+ ARGS="./"
+fi
+
# Check implementation
if which tree &> /dev/null; then
TREE="tree"