You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "LeVan,Ralph" <le...@oclc.org> on 2015/07/09 22:25:26 UTC

[CLI] Configure Options from usage statement??

My apologies if I'm going about this wrong.

Several years ago I wrote a layer on top of JSAP to configure its parser from a simple usage statement.  I tried to push that code back to the developer, with no success.  I'd like to see that code get into production somewhere so I can stop using my private fork.

For JSAP, configuration turned into this:
        SimplerJSAP jsap = new SimplerJSAP("dbname [--taglist<String>] [--alternativeTagpaths<File>]");
        JSAPResult config = jsap.parse(args);

This is much simpler and much much more readable than the JSAP code and it looks to me like the CLI version is just as complicated.

Would there be any interest in me contributing such a layer on top of CLI?

Thanks!

Ralph

--

Ralph LeVan

OCLC * Senior Research Scientist, OCLC Research

6565 Kilgour Place, Dublin, Ohio USA 43017

T +1-614-764-6115

[OCLC]<http://www.oclc.org/home.en.html?cmpid=emailsig_logo>

OCLC.org<http://www.oclc.org/home.en.html?cmpid=emailsig_link> * Facebook<http://www.facebook.com/pages/OCLC/20530435726> * Twitter<http://twitter.com/oclc> * YouTube<http://www.youtube.com/OCLCvideo>



Re: [CLI] Configure Options from usage statement??

Posted by "LeVan,Ralph" <le...@oclc.org>.
Optionals are marked by brackets, as in the example. Help text could be provided as text in parens after the parameter declaration. I don't do that currently (if JSAP had that capability, I never noticed), so if you'd like to propose another mechanism I'd be happy to consider it.

Ralph



On Thu, Jul 9, 2015 at 10:41 PM -0700, "Benedikt Ritter" <br...@apache.org>> wrote:

Hello Ralph,

2015-07-09 22:25 GMT+02:00 LeVan,Ralph <le...@oclc.org>:

> My apologies if I'm going about this wrong.
>
> Several years ago I wrote a layer on top of JSAP to configure its parser
> from a simple usage statement.  I tried to push that code back to the
> developer, with no success.  I'd like to see that code get into production
> somewhere so I can stop using my private fork.
>
> For JSAP, configuration turned into this:
>         SimplerJSAP jsap = new SimplerJSAP("dbname [--taglist<String>]
> [--alternativeTagpaths<File>]");
>         JSAPResult config = jsap.parse(args);
>
> This is much simpler and much much more readable than the JSAP code and it
> looks to me like the CLI version is just as complicated.
>
> Would there be any interest in me contributing such a layer on top of CLI?
>

Interesting. This certainly only works for simple CLIs. How would you
handle mandatory vs. optional options? And how can a help text be added
with this API?

Benedikt


>
> Thanks!
>
> Ralph
>
> --
>
> Ralph LeVan
>
> OCLC * Senior Research Scientist, OCLC Research
>
> 6565 Kilgour Place, Dublin, Ohio USA 43017
>
> T +1-614-764-6115
>
> [OCLC]<http://www.oclc.org/home.en.html?cmpid=emailsig_logo>
>
> OCLC.org<http://www.oclc.org/home.en.html?cmpid=emailsig_link> * Facebook<
> http://www.facebook.com/pages/OCLC/20530435726> * Twitter<
> http://twitter.com/oclc> * YouTube<http://www.youtube.com/OCLCvideo>
>
>
>


--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: [CLI] Configure Options from usage statement??

Posted by Benedikt Ritter <br...@apache.org>.
Hello Ralph,

2015-07-09 22:25 GMT+02:00 LeVan,Ralph <le...@oclc.org>:

> My apologies if I'm going about this wrong.
>
> Several years ago I wrote a layer on top of JSAP to configure its parser
> from a simple usage statement.  I tried to push that code back to the
> developer, with no success.  I'd like to see that code get into production
> somewhere so I can stop using my private fork.
>
> For JSAP, configuration turned into this:
>         SimplerJSAP jsap = new SimplerJSAP("dbname [--taglist<String>]
> [--alternativeTagpaths<File>]");
>         JSAPResult config = jsap.parse(args);
>
> This is much simpler and much much more readable than the JSAP code and it
> looks to me like the CLI version is just as complicated.
>
> Would there be any interest in me contributing such a layer on top of CLI?
>

Interesting. This certainly only works for simple CLIs. How would you
handle mandatory vs. optional options? And how can a help text be added
with this API?

Benedikt


>
> Thanks!
>
> Ralph
>
> --
>
> Ralph LeVan
>
> OCLC * Senior Research Scientist, OCLC Research
>
> 6565 Kilgour Place, Dublin, Ohio USA 43017
>
> T +1-614-764-6115
>
> [OCLC]<http://www.oclc.org/home.en.html?cmpid=emailsig_logo>
>
> OCLC.org<http://www.oclc.org/home.en.html?cmpid=emailsig_link> * Facebook<
> http://www.facebook.com/pages/OCLC/20530435726> * Twitter<
> http://twitter.com/oclc> * YouTube<http://www.youtube.com/OCLCvideo>
>
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter