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.