Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.51 KB

README.rdoc

File metadata and controls

57 lines (39 loc) · 1.51 KB

CommandLineLib

This is a simple library to help buidind command line programs based on bash.

Compiling and installing

You can use ant to generate the commandlinelib.jar. All you have to do is type

> ant

and voila!

How does it work?

Here’s a simple example showing how to build the menus:

CLMenu menu1 = new CLMenu(“First Menu”, “This is the First Menu”); CLMenu menu11 = new CLMenu(“Another Menu”, “This is Another Menu”);

CLForm personalForm = new CLForm(“Personal information”, “Please, enter your personal information”){ @Override public void run() { System.out.println(“you name is ” + getQuestions().get(0).getAnswer()); System.out.println(“you age is ” + getQuestions().get(1).getAnswer()); System.out.println(“you gender is ” + getQuestions().get(2).getAnswer()); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } }; personalForm.addQuestion(“What is your name?”); personalForm.addQuestion(“What is your age?”); personalForm.addQuestion(“What is your gender?”); addOption(menu1); addOption(new CLOption(“A single option”){ @Override public void run() { System.out.println(“Something done!”); } }); menu1.addOption(menu11); menu1.addOption(new CLOption(“Do something”)); menu1.addOption(personalForm);

Please take a look at the TestCLInterface class, under the test lib for a more complete example.

License

This code is licensed under the ApacheLicense