[
https://issues.apache.org/jira/browse/HADOOP-9158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13585520#comment-13585520
]
Jonathan Allen commented on HADOOP-9158:
----------------------------------------
I've looked through the commons CLI classes and there's certainly some things
we could use to improve the command parsing and help functionality.
Unfortunately I don't think the HelpFormatter class will be usable, there's a
number of specific issues with it such as:
a) Doesn't print command arguments in usage, e.g."-ls [-d] [-h] [-R] <path>
..." would lose the <path> unless the full syntax was hardcoded in the usage
message.
b) It left justifies all descriptions, options can be indented but not header
or footer text. There's several cases in the current help text where things are
indented to make them more readable.
c) Doesn't handle formatting within text, currently several help messages (e.g.
ls) include some formatted text to make it more readable.
It's not readily extensible to resolve these issues.
I think it's still worthwhile using the Options and CommandLineParser classes
as they make things more flexible and provide additional functionality we could
make use of. This can be hidden behind the current CommandFormat class to
provide backwards compatibility. One compatibility issue I have come across is
the use of a dash parameter for stdin, e.g. "hadoop fs -put - test.txt". With
the CLI parsers the dash is treated an option terminator and not added to the
list of arguments (unless stopAtNonOption=false, which causes other issues).
This can be resolved by using double dash an option terminator (in line with
most Linux commands), e.g. "hadoop fs -put -- - test.txt", but this would
change the user interface.
Any thoughts?
> Tidy up fs -help
> ----------------
>
> Key: HADOOP-9158
> URL: https://issues.apache.org/jira/browse/HADOOP-9158
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: Jonathan Allen
> Assignee: Jonathan Allen
> Priority: Minor
> Attachments: HADOOP-9158.patch
>
>
> There are a number of issues with the current fs -help implementation that
> could do with tidying up.
> 1) Running 'hadoop fs -help' displays the full detailed help for all
> commands. This produces a large amount of text and makes it hard to find
> what you're looking for. Better functionality would be:
> - hadoop fs -usage : shows the basic usage information for all commands
> - hadoop fs -help : shows usage and brief summary (couple of lines) for all
> commands
> - hadoop fs -help <command> : shows full description of the specified command
> 2) Help text is hardcoded into each command class. This should be replaced by
> resource files to allow internationalisation.
> 3) Line breaks are hardcoded into the help text. The help text should be
> auto-formatted at display time.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira