[Toybox] Options and help

Rob Landley rob at landley.net
Thu Aug 16 20:08:04 PDT 2012


On 08/15/2012 06:46 AM, Elie De Brauwer wrote:
> Hello list,
> 
> Something I noted, probably it's already known, but just wanted to raise
> this.

Yeah, it's known. It's one of my larger todo list items, and the reason
the menuconfig->help converter was originally written in python rather
than shell, until I decided that was a bad idea.

> When commands have functionality hidden behind options (e.g.
> sleep.c has SLEEP_FLOAT and sort has SORT_BIG or SORT_FLOAT) it is
> apparently possible to have the command parser cope with these options
> (see sort.c for an example), but this doesn't work for the help string.
> Help will only display the string matching USE_XXX, which as with
> command line parsing certain flags should be optional.

I need logic that will:

A) merge the usage: strings at the start of each section (if any)

B) concatenate the help text.

(This is tied in with the switch_root stuff, I need to overhaul the
scripts/make.sh plumbing and rewrite a lot of it in C. There was a
contribution a while back redoing the code in C, but it didn't take into
account pending design changes.)

> So while a make defconfig gives you all options enabled for sleep and
> sort, the help will only display the minimalistic version:
> 
> edb at lapedb:~/edb-stuff/toybox/toybox$ ./toybox help sleep
> usage: sleep SECONDS
> 
> Wait before exiting.
> edb at lapedb:~/edb-stuff/toybox/toybox$ ./toybox help sort
> usage: sort [-run] [FILE...]
> 
> Sort all lines of text from input files (or stdin) to stdout.
> 
> -r    reverse
> -u    unique lines only
> -n    numeric order (instead of alphabetical)
> 
> my 2 cents

Yup, it's a problem, dating back to the old days:

  http;//landley.net/notes-2007.html#06-01-2007

Saying "it's on my todo list" doesn't help. Sorry I've been absent
recently, I fell about 2 weeks behind on email due to work and the
kernel Documentation stuff burying my inbox in 300 unread (and mostly
but not entirely irrelevant) messages. Today I got half a day off from
work and spent it catching partway up.

Today I finally got the darn "aboriginal building on fedora" bug fixed,
and have two more todo items left for the release. Once I've got that
working, my next big thing is to swap toybox in as part of the default
aboriginal (and thus linux from scratch) build.

After the 3.5 kernel release I put aboriginal in front of toybox on the
todo list because it's approaching the line separating "behind" and
"dead". But aboriginal is a more mature product built around third party
code, meaning its bugs are harder to solve (the fedora one was evil).

I think the big thing for the 0.5 toybox release should be "redoing the
make infrastructure" so the help generator isn't in python anymore, the
help text actually gets collated to include sub-options, the build can
handle commands with underscores/dashes in them.

And while I'm at it move the commands into toys/{posix,lsb,other} (maybe
android and development in there, but posix and lsb should be split
out). This means the menuconfig stuff should show all the posix commands
in one menu, all the LSB ones in another, and so on.

> E.

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.



More information about the Toybox mailing list