On 5/26/10 7:55 AM, Grant Ingersoll wrote:
On May 25, 2010, at 11:51 PM, Jake Mannix wrote:

2) In getting a feel for Mahout, I've been running a few of the examples on
my own, and have noticed that if I supply the "-h" argument by itself to
some of the available programs, I get an exception, followed by the list of
available options for that program. For instance, in running "./bin/mahout
seq2sparse -h":

That is almost definitely a bug in either AbstractJob, or the Driver class
which is using it.  File a JIRA ticket for it, and earn brownie points from
all of us (find out where in the code it's barfing, get even Bigger points,
and if you post too many patches fixing said problems, and you'll wind
up inadvertently becoming a committer!).
It's kind of a bug, kind of just laziness about creating the right kind of 
Option structure.  It occurs out of the fact that we have required options, but 
we don't put them in a group, so the CLI parser pukes before it recognizes that 
there is a --help request.  The fix, I suppose, is to figure out CLI2 handles 
saying something to the effect of either --help is required (and can be 
standalone) or if not a help request, then some other stuff may be required.
Even better than my crude hack idea, adding these 2 lines seems to resolve the problem:

      Parser parser = new Parser();
      parser.setGroup(group);
+      parser.setHelpFormatter(new HelpFormatter());
+      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);

Reply via email to