[ 
https://issues.apache.org/jira/browse/HBASE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12834038#action_12834038
 ] 

ryan rawson commented on HBASE-2229:
------------------------------------

Basically simplicity.  Here is their well done example page:
http://jopt-simple.sourceforge.net/examples.html

Here is a compairson:

    Options options = new Options();
    options.addOption( OptionBuilder.withArgName("user")
        .hasArg()
        .isRequired()
        .withDescription("user to use")
        .create("user") );

// .. later ..
    CommandLineParser clp = new GnuParser();
    CommandLine line = clp.parse( opts, args );

// now read your arguments out of the 'line' object, eg:
String user = cl.getOptionValue("user");

Equivalent example in jopt-simple:
OptionParser parser = new OptionParser();
parser.accepts("user").withRequiredArg();

OptionSet options = parser.parse( args );

String user = options.valueOf("user");

/// Or if you are doing single character options:
OptionParser parser = new OptionParser( "u::" );
OptionSet options = parser.parse( args ) ;
String user = options.valueOf("user");



> convert all command line parsing to jopt simple
> -----------------------------------------------
>
>                 Key: HBASE-2229
>                 URL: https://issues.apache.org/jira/browse/HBASE-2229
>             Project: Hadoop HBase
>          Issue Type: Bug
>            Reporter: ryan rawson
>            Priority: Minor
>             Fix For: 0.21.0
>
>
> what we are doing right now is wonky, we should use jopt simple, which 
> attempts to emulate ye olde classic opt parsers from C in their brevity and 
> terseness.
> http://jopt-simple.sourceforge.net/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to