Bugs/missing documentation in JCli API

Bug #537132 reported by Sean Flanigan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
jcli
Fix Released
Undecided
Unassigned

Bug Description

The following test class shows three things which weren't clear from the example or the JavaDocs.

1. @Cli is not mentioned on the example page
2. the longName version of an option is never set if it contains a dash ("-")
3. the ArgumentProcessor does not enforce required options

import java.io.File;

import org.cyclopsgroup.jcli.ArgumentProcessor;
import org.cyclopsgroup.jcli.annotation.Cli;
import org.cyclopsgroup.jcli.annotation.Option;

// NB: JCli example page does not mention @Cli
@Cli(name = "test")
public class TestLongName {

 File srcDir;

 public static void main(String[] args) {
  TestLongName pojo = new TestLongName();
  ArgumentProcessor<TestLongName> argProcessor = ArgumentProcessor.newInstance(TestLongName.class);
  argProcessor.process(args, pojo);
  System.out.println(pojo.srcDir);
 }

 // NB: longName options which include "-" are never set
 // NB: required options are not enforced
 @Option(name="s", longName="src-dir", required = true)
 public void setSrcDir(File srcDir) {
  this.srcDir = srcDir;
 }
}

Jiaqi Guo (jiaqi-guo)
Changed in jcli:
status: New → Confirmed
Revision history for this message
Sean Flanigan (sflaniga) wrote :

Another point about the http://wiki.cyclopsgroup.org/jcli:example page. The @Argument values will be silently ignored unless a setArguments() method is implemented.

Jiaqi Guo (jiaqi-guo)
Changed in jcli:
status: Confirmed → Fix Committed
Revision history for this message
Jiaqi Guo (jiaqi-guo) wrote :

I created a separated bug https://bugs.launchpad.net/jcli/+bug/545748 for required options enforcing issue, which is on my list of things. Thank you for reporting the problems.

Jiaqi Guo (jiaqi)
Changed in jcli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.