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

Appy commented on HBASE-16982:
------------------------------

Oops, forgot to put an example of how help message is formatted.

{noformat}
appy asharma-MBP ~/apache/hbase (exp_snap_cleanup) → ./bin/hbase 
org.apache.hadoop.hbase.snapshot.ExportSnapshot --help
usage: bin/hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot <options>
Options:
    --snapshot <arg>       Snapshot to restore.
    --copy-to <arg>        Remote destination hdfs://
    --copy-from <arg>      Input folder hdfs:// (default hbase.rootdir)
    --target <arg>         Target name for the snapshot.
    --no-checksum-verify   Do not verify checksum, use name+length only.
    --no-target-verify     Do not verify the integrity of the exported snapshot.
    --overwrite            Rewrite the snapshot manifest if already exists.
    --chuser <arg>         Change the owner of the files to the specified one.
    --chgroup <arg>        Change the group of the files to the specified one.
    --chmod <arg>          Change the permission of the files to the specified 
one.
    --mappers <arg>        Number of mappers to use during the copy 
(mapreduce.job.maps).
    --bandwidth <arg>      Limit bandwidth to this value in MB/second.

<footer string>
{noformat}

> Better integrate Apache CLI in AbstractHBaseTool
> ------------------------------------------------
>
>                 Key: HBASE-16982
>                 URL: https://issues.apache.org/jira/browse/HBASE-16982
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Appy
>            Assignee: Appy
>         Attachments: HBASE-16982.master.001.patch, 
> HBASE-16982.master.002.patch
>
>
> Problem
> 1. Inconsistencies in our user facing tools.
> - options:
>     start with single/double dash
>     words separated by dash or underscore or just joined together
>     someplace use '=' to separate value, other use space (ExportSnapshot vs 
> HashTable)
> - Description
>   Manually formatting options and their descriptions in printUsage()
>   Inconsistant formatting, sometimes even weird.
>   Incomplete. Sometimes people forget to add new option to description
> 2. Manual parsing of options (those huge if-else loops iterating over args)
> Solution
> Use Apache CLI
> - It has various validations for option names which'll fix first set of 
> issues.
> - using AbstractHBaseTool's print usage function will ensure consistent 
> formatting (although we loose the power to order the options)
> - If we enforce the method of defining options as in patch, it's highly 
> unlikely to forget adding description.
> - CLI parses the options for us.
> Using Apache CLI when writing new tools is straight forward, but it's not 
> easy when porting exiting tools since some option names are not valid as per 
> CLI's validation.
> New method, processOldArgs(), will allow to port these tools in a backward 
> compatible manner.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to