On 17 January 2012 14:47, Simone Tripodi <[email protected]> wrote:

> Hi all/Michele,
>

Hi Guys,

>
> while reading the core source, I noticed that CLI is managed via the
> outdated commons-cli, I tried to replaced it with something more
> sophisticated like JCommander[1] (ASL2.0) but I stopped as soon as I
> started because I noticed the code uses custom annotations, so worried
> about breaking something, I gave up.
>
> My question is: can you give me please a little of background about
> the CLI design?
>

Well, any org.apache.any23.cli.Tool implementation provides a static void
main(String[])
access point which allows to run it directly.

There is however a special CLI tool called org.apache.any23.cli.ToolRunner
which takes
care to detect all the CLI Tool implementations declared within the class
path
(asking also to the PluginManager) and drive an 'assisted' invocation.

The invocation of org.apache.any23.cli.ToolRunner without parameters will
list all the
available Tools. To invoke a specific Tool just run:

org.apache.any23.cli.ToolRunner <tool-class-simple-name>
[<specific-tool-params>]

The replacement of commons-cli with another options parsing library will
not interfere
with the custom annotations applied to the org.apache.any23.cli.Tool
instances in any way.

Let me know if you need any further explanation.

Bye

Mic


> Any hint/help would be really appreciated!
> Many thanks in advance, all the best!
> -Simo
>
> [1] http://jcommander.org/
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>



-- 
Michele Mostarda
Senior Software Engineer
skype: michele.mostarda
twitter: micmos
mail: [email protected]
site : http://www.michelemostarda.com

Reply via email to