In Java, I want to make a simple, quick console app that provides a series of menus and takes user input, then calls certain methods and outputs other menus. Basically, I need to create a loop:
menu > user selection > action > menu > ...
Ultimately, I'm using this on top of an integration server using Apache Camel. I have a "quick and dirty" app I use to exercise some of the server routes as a development tool. I don't want to spend a lot of time on something so simple.
There has to be an easy way to do this. Consoles and menus on command lines have been around for decades! There must be a java library out there that does this well. I just haven't found one...
Is there a library out there or some Apache utility, or anything that would make creating super quick, super simple console menus a piece of cake?
With the proper tool, it should take less than 30 minutes to make a menu that functions likegit add -i
That is, I need to make something that functions similar to git Interactive commands, or any other console app, and I want to do so quickly.
EDIT:
The suggestion, below, to use "Cliche" worked pretty well, allowing me to just annotate some methods and have a menu built out of that, automatically. In case it helps someone, I wanted to include some important notes on getting Cliche working:
Add a repo:
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
Add dependency:
<dependency>
<groupId>com.googlecode.cliche</groupId>
<artifactId>cliche</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Take a look at Cliche
It uses @Command
method annotations to rapidly create interactive console-based apps. Its type converters are basic but Camel's own extensive type converters could be configured to be used instead. It also offers extra functionality like listing available commands and convention-driven input abbreviations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With