Aesh is a Java library for building interactive CLI applications with commands, options, arguments, completions, and more. Aesh handles parsing, validation, injection, and terminal interaction so you can focus on your command logic.
<dependency>
<groupId>org.aesh</groupId>
<artifactId>aesh</artifactId>
<version>3.0</version>
</dependency>Easy to use annotation-based API (with an optional builder API)
Options (single, list, group) and arguments with automatic injection
Built-in completers for files, booleans, and default values
Group commands and sub-command mode (e.g.
git rebase,git pull)Custom validators, activators, completers, converters, and renderers
Auto-generated help text from command metadata
Compile-time annotation processor for reflection-free command metadata (faster startup, GraalVM-friendly)
Add and remove commands at runtime
Terminal graphics utilities: progress bar, table, tree display
Line editing, history, undo/redo, paste buffer
Emacs and Vi editing modes
Masking, redirect, alias, pipeline support
Works on POSIX systems and Windows
Add the aesh-processor dependency to generate command metadata at compile time, eliminating runtime reflection for annotation scanning and improving startup time. This is especially useful for GraalVM native images.
<dependency>
<groupId>org.aesh</groupId>
<artifactId>aesh-processor</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>No code changes required — if the generated metadata is on the classpath, Aesh uses it automatically. Otherwise it falls back to the existing reflection-based approach.
importorg.aesh.AeshConsoleRunner;
importorg.aesh.command.Command;
importorg.aesh.command.CommandDefinition;
importorg.aesh.command.CommandResult;
importorg.aesh.command.invocation.CommandInvocation;
importorg.aesh.command.option.Option;
publicclassSimpleExample {
publicstaticvoidmain(String[] args) {
AeshConsoleRunner.builder()
.command(HelloCommand.class)
.addExitCommand()
.prompt("[aesh]$ ")
.start();
}
@CommandDefinition(name = "hello", description = "say hello")
publicstaticclassHelloCommandimplementsCommand<CommandInvocation> {
@Option(description = "your name")
privateStringname;
@OverridepublicCommandResultexecute(CommandInvocationinvocation) {
if (name != null) {
invocation.println("Hello, " + name + "!");
} else {
invocation.println("Hello!");
}
returnCommandResult.SUCCESS;
}
}
}Full documentation is available at aeshell.github.io.
Aesh uses Maven as its build tool:
mvn install
Aesh is licensed under the Apache License, Version 2.0.