High Level API

The high level API enables you to create commands with a variety of options/arguments, completors, validators, ++ fast and efficiently. The way to enable the high level API is to use the AeshConsole. The only way to initiate AeshConsole is to use the AeshConsoleBuilder class. AeshConsoleBuilder accept several different objects, all of them are described below except Settings which can be found here.


CommandRegistry is the registry where all the commands are stored. Æsh provide a default CommandRegistry if no external is provided.


It is possible to specify your own CommandInvocation implementation and to enable that you have to specify your own CommandInvocationProvider. It is possible to have multiple CommandInvocationProviders and this is controlled by the CommandInvocationService. Æsh provide a default implementation for all these classes.


Æsh allow you to specify a CommandNotFoundHandler that will be called when a user tries to execute a command which name is not found. Æsh will fall back to a default handler if none is provided.


To make the man command useful it is important to provide a custom ManProvider. There is no need to implement this if man isnt enabled.


Specify the Prompt that will be shown at startup. It is possible to change the prompt when needed during runtime.

In the end a small example to tie it all together
public AeshConsoleExample {
  public static void main(String[] args) {
      Settings settings = new SettingsBuilder()
      CommandRegistry registry = new AeshCommandRegistryBuilder()
      AeshConsole aeshConsole = new AeshConsoleBuilder()
              .manProvider(new ManProviderExample())
              .prompt(new Prompt("[aesh@rules]$ "))

back to top