Share

Natural CLI

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Problems with HelpCommandExecutor

  1. 2008-04-04 03:14:11 UTC
    First, I think that Natural CLI is absolutely brilliant. Great job!

    But... I'm either confused, or having a problem. (probably confused)

    When I create a simple command processor (further below) and pass it 'help' on the command line (without the quotes of course), I get the following output.

    org.naturalcli.Syntax@156ee8e
    Shows the commands help on plain text.

    org.naturalcli.Syntax@47b480
    Says hello.

    I think the issue may be in the HelpCommandExecutor method, but then again, I'm probably confused.

    Thanks for any help, and keep up the good work.

    Paul


    My example code is as follows:

    package test.cli;

    import java.util.HashSet;
    import java.util.Set;

    import org.naturalcli.Command;
    import org.naturalcli.ExecutionException;
    import org.naturalcli.ICommandExecutor;
    import org.naturalcli.InvalidSyntaxException;
    import org.naturalcli.NaturalCLI;
    import org.naturalcli.ParseResult;
    import org.naturalcli.commands.HelpCommand;

    public class main {

    public static void main(String[] args) {
    try {
    // Create the set for the commands
    Set<Command> cs = new HashSet<Command>();

    // Create the commands
    cs.add(new HelpCommand(cs));
    cs.add(new Command("hello world",
    "Says hello.",
    new ICommandExecutor ()
    { public void execute(ParseResult pr )
    { System.out.println("Hello world!"); }
    }
    ));

    // Execute
    new NaturalCLI(cs).execute(args);

    } catch (ExecutionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (InvalidSyntaxException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }
  2. 2008-04-10 15:27:20 UTC
    Hi,

    I just submitted a bug report about this so, no, you're not confused. Apparently it's the Syntax class that's missing a toString(). I'm trying to fix it myself to be able to move on. Otherwise, it's a great little utility.

    Johan
  3. 2008-04-10 23:50:28 UTC
    Hi,

    First of all, thanks for your feedback and for summiting the bug. I'm going to see what is happening and I'll provide a new patched release soon.

    Thanks again!

    Ferran
  4. 2008-04-13 01:56:05 UTC
    HI,

    Just notice that there are a new release with the changes to this issue and others bug fixes.

    Thanks a lot for you feedback! If there are any other thing to solve or any feature request, it'll be welcome.

    best regards,

    Ferran
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.