To define a CLI command, simply declare a class implementing the CommandLineHandler interface and annotated with @CliCommand:
@CliCommand("myCommand") public class MyCommandLineHandler implements CommandLineHandler { @Override public Integer call() throws Exception { return 0; } } This will register the command named myCommand without any option or argument. When this command is invoked from the command-line, the call method is invoked. You must return an integer code from this method which will be returned to the operating system.
The seed-cli
module provides support for creating applications that are run from the command-line, accepting options
and arguments.
Running a SeedStack application is done by using the SeedMain class as entry point. This main class searches for a launcher on the classpath and delegates the startup and shutdown logic to it. A launcher is a class implementing SeedLauncher.
SeedStack provides two built-in launchers:
In the seed-cli module, for command-line applications. In the seed-web-undertow, for Web applications embedding their own server. Web applications executed in a Servlet container don’t require a launcher as they are completely managed by the container.
SeedStack shell add-on provides access to application administrative commands through SSH protocol.