[PATCH] Extra Command Line library functionality (option grouping and runtime inspection/modification)
Daniel Liew
daniel.liew at imperial.ac.uk
Thu May 2 12:29:11 PDT 2013
On 02/05/13 19:26, Matt Arsenault wrote:
>
> On Apr 22, 2013, at 7:03 , Daniel Liew <daniel.liew at imperial.ac.uk> wrote:
>
>> On 22/04/13 11:02, Daniel Liew wrote:
>>
>> I tweaked the implementation and documentation slightly. The new version
>> of the patches are attached.
>
> There are 2 parts of this I didn't like. Regular -help still exists, and prints all options. I think it would make more sense for -help to by default print categorized. Alternatively, I think it would make sense for only options that aren't given a category to be printed by -help, and then each category would have a flag (-help-<category name>) instead of having a separate -help-cat which nobody would ever know about / use. I've modified this patch to behave this way in an unrelated project of mine that uses a small forked subset of the parts of the support library I like.
You may be using an old version of my patch (sorry I've been through
quite a few revisions). -help-cat doesn't exist any more. There is only
-help. The behaviour of -help changes automatically. If there are two or
more option categories are declared then -help shows categorised options
instead of uncategorised options.
In addition when the the output of -help changes to categorised output
an option -help-list becomes unhidden which allows the user to see
uncategorised output.
In principle adding -help-<category> options wouldn't be too hard but
I'm not sure there's a huge benefit.
What I really wanted was
--help : show uncategorised output
--help=<category>[,<category>...] : show options for particular category
--help=all : Show all options categorised
That seemed too difficult for me to implement though so I went for
something simpler (simply -help that changes behaviour automatically).
I just posted an amended patch
http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20130502/bedf9064/attachment-0001.bin
See if you prefer it.
> As a minor point, you are missing consts in a bunch of places. (e.g OptionCategory::getName(), cat's Category should be const reference)
I assume you mean const pointer? I amended my code in the patch anyway.
Thanks,
Dan.
More information about the llvm-commits
mailing list