Installing
----------

Drop the script anywhere, make it executable, optionally edit it and change
the default value of $EXTENSIONDIR. Run it with /bin/busybox sh.

Using
-----

# /bin/busybox sh aloop.sh -h 
Usage: aloop.sh [options]
  parse menu files in /mnt/us/extensions

Options:
 -h | --help
 -c=MAX | --colors=MAX   : max cyclical index when -f=twolevel (default 2)
 -f=NAME | -format=NAME   : select output format, NAME is one of:
   default     default format, also when -f isn't specified, sortable
   debuginfo   dump xml_* and json_* variables
   touchrunner compatible with TouchRunner launcher, sortable
   twolevel    default + group name and color index, sortable, see also -c
 -s | --sort   : sort output by label
 
Limitations:
. Supports json menus only
. Supports one- or two-level menus only
. A menu entry must not extend across multiple lines. Example of a valid entry:
  {"name": "a label", "priority": 3, "action" : "foo.sh", "params": "p1,p2"}
  with or without a traling comma

Examples
--------
*** My favorite one is # 5 *** or # 7

# 1 simple label (without top menu name) + action, unsorted
/bin/busybox sh aloop.sh

# 2 list of parsed values
/bin/busybox sh aloop.sh -f=debuginfo

# 3 if you use the TouchRunner launcher
/bin/busybox sh aloop.sh -f=touchrunner -s >> /mnt/us/touchrunner/commands.txt

# 4 for two-level nested menus, like Komic, label = menu name + item name
# the first column is a 'color group' index, see #6-8
/bin/busybox sh aloop.sh -f=twolevel

# 5 sort the two-level index by menu (top) level name and leave
# sub-items in the same order they appear in their json file
/bin/busybox sh aloop.sh -f=twolevel -s

# 6 the 'color index' rolls over every N menus, use -c=N if you want more
# than two color groups, three for instance
/bin/busybox sh aloop.sh -f=twolevel -s -c=3

# 7 Use -c=999 if you want a serial index from 0 to 998
/bin/busybox sh aloop.sh -f=twolevel -s -c=999

# 8 Use -c=0 to disable color index output
/bin/busybox sh aloop.sh -c=0

Release history
---------------

20130125,a,stepk
+ auto fix DOS line endings
+ added $PRODUCTNAME="Unified Kindle Launcher"
+ -c=0 disables color index output
+ if no menu items found install a test applet (411)
- fix: bail out on unknown script option
+ documentation: added README-dev.txt

20130124,a,stepk
+ option -h | --help
+ option --format=debuginfo
+ options --format=twolevel and -c=|--colors=N
+ config.xml and menu.json can reside in different folders
! search extensions by config.xml (was by menu.json)
! extract group (top) menu name from json file (was from config.xml)
- silently reject invalid xml/json files
+ documented parser's limitations (corner cases)
* minor tweaks and fixes
* code factorization

20130122,c,stepk
+ options --sort and --format=touchrunner

20130122,a,stepk
= first version