0

I was wondering if there is a robust and easy-to-use framework for Java using which I can define my custom commands and add them to the shell without having to worry about the internals of the shell framework and the phases and behaviour of command execution. My requirement is very simple. I need CLI for most of the applications I write. And for each of them, I don't want to write an app-specific shell. But instead, if I have a shell framework using which I can create my commands and add them to the shell, it would be very helpful.

Custom command would be something like this:

class MyCommand implements ShellCommand{

        @Override
        public void run(){
                // application logic goes here
        }

        @Override
        public String getUsage(){
                return "Usage: foo [bar] [bar]";
        }

        @Override
        public String getDescription(){
                return "shows all files in the directory.. blah blah";
        }
}

The shell would be great if it has a built-in HTTP-server which can execute commands from the HTTP requests through webservices.

Amith Koujalgi
  • 10,746
  • 2
  • 18
  • 22
  • Have you looked at Apache CLI? http://commons.apache.org/cli/ – Andremoniy Feb 14 '13 at 08:55
  • 1
    First result in google: http://java.dzone.com/announcements/clamshell-cli-framework – BobTheBuilder Feb 14 '13 at 08:55
  • 2
    And http://stackoverflow.com/questions/1524661/the-best-cli-parser-for-java – BobTheBuilder Feb 14 '13 at 08:56
  • @baraky: I have actually come across that and I found that to be a nice model but unfortunately it is not compatible with 64-bit Windows since it uses [JLine](http://jline.sourceforge.net/) library and it is also not fully compatible with JDK 1.7. I can't restrict myself to JDK 1.6 or lower! – Amith Koujalgi Feb 14 '13 at 09:06
  • @Andremoniy: Apache CLI is for parsing commandline args. I'm looking forsomething like an interpreter (like bash or sh in Unix) – Amith Koujalgi Feb 14 '13 at 13:01

0 Answers0