Java CLI UI-design: frameworks or libraries? [closed]

被刻印的时光 ゝ 提交于 2019-11-29 06:42:29

问题


I'm currently working on a small utility program that only requires a command line interface, and I started wondering if Java provided any standard way of creating the CLI, in a similar way that Swing and the likes exist for GUIs. I'm not really interested in command line parameters and parsing of them, but rather the command based interaction the user has with the program to use it. This is for the situations where GUI simply is unnecessary or not an option for using the program.

Googling the subject pretty much only results in tutorials on how to use BufferedReader and the likes to do rudimentary interaction with the user, aimed at people learning the basics of Java and writing simple UI that asks for name and prints "Hello World!" etc..

Are the any libraries that are focused on providing a good framework for quickly implementing a more complex CLI UI or is this really something that everyone implements in ad hoc manner for their own utilities?

Maybe someone knows of patterns for the implementation that were created back in time when not everything was graphical? That would also be useful resource.


回答1:


Perhaps CLI Toolkit...

http://alexis.royer.free.fr/CLI/




回答2:


You can also have a look and Clamshell-cli or spring shell:

  • Clamshell-cli is relatively simple and easy to use : You can look at jmx-cli to get a nice example of what can be done with it.

  • Spring Shell is bigger but more feature-full (tab completion, etc). It has been extracted from spring Roo and released as an independent framework




回答3:


There is a project called JLine that provides cross-platform support for general command-line input handling:

http://jline.sourceforge.net/

More of a support library than a framework though.




回答4:


Try searching for CURSES and java, something like http://www.google.co.uk/search?q=curses+for+java . Long time ago CHARVA ( http://www.pitman.co.za/projects/charva/index.html ) looked nice.




回答5:


I've used the apache commons CLI library in the past and has worked well for me: http://commons.apache.org/cli/



来源:https://stackoverflow.com/questions/2417495/java-cli-ui-design-frameworks-or-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!