aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-30 09:24:59 -0400
committerKen Moore <moorekou@gmail.com>2016-06-30 09:24:59 -0400
commit08f6b215cdaa43cb27d1a46343fbaf1a43031017 (patch)
treefeeb5b9e2877686bf15861149d56e4454ea11bf8
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-08f6b215cdaa43cb27d1a46343fbaf1a43031017.tar.gz
lumina-08f6b215cdaa43cb27d1a46343fbaf1a43031017.tar.bz2
lumina-08f6b215cdaa43cb27d1a46343fbaf1a43031017.zip
Update the new ls.json.sh script so ti works properly now.
-rwxr-xr-xJsonMenu_Scripts/ls.json.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/JsonMenu_Scripts/ls.json.sh b/JsonMenu_Scripts/ls.json.sh
index 9a6ab847..7bd09e2d 100755
--- a/JsonMenu_Scripts/ls.json.sh
+++ b/JsonMenu_Scripts/ls.json.sh
@@ -1,10 +1,20 @@
#!/bin/sh
-cmd="ls $1"
-OUT=""
-for name in `${cmd}`; do
- if [ "${OUT}" != "" ] ; then
+DIR=${1}
+if [ "$1" == "" ] ; then
+ DIR=`pwd`
+fi
+
+ls ${DIR} > /tmp/.tmp.lines.$$
+while read name
+do
+ if [ -n "${OUT}" ] ; then
OUT="${OUT},"
fi
- OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"action\" : \"${name}\"}"
-done
+ if [ -d "${DIR}/${name}" ] ; then
+ OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} ${DIR}/${name}\", \"icon\":\"folder\"}"
+ else
+ OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"${name}\"}"
+ fi
+done < /tmp/.tmp.lines.$$
+rm /tmp/.tmp.lines.$$
echo "{ ${OUT} }"
bgstack15