Libraries for constructing an interactive shell for Java application [closed]

匆匆过客 提交于 2019-12-02 20:42:52

Options to consider:

  • javacurses / JCurses - a console-based windowing toolkit, similar to the UNIX curses design
  • swing-console might be appropriate if you want a console-style view / output in a Swing GUI window. you could use this to build an interactive shell.
  • JLine - library for console input similar to GNU readline
  • Several JVM languages offer an interactive REPL environment which can be used as an interactive shell, e.g. Clojure

We are using Spring shell, and it worked really well for us. Some of its features:

  • A simple, annotation driven, programming model to contribute custom commands

  • Use of Spring's classpath scanning functionality asthe basis for a
    command plugin strategy and command develoment

  • Inheritance of the Roo Shell features, most notably tab completion, colorization, and script execution.

  • Customization of command prompt, banner, shell history file name.

burna

According to this Question JLine can be a good try.

Features of JLine

  • Command history - Lines that have been previously entered may be recalled and edited and can be persisted so that they are available
    across sessions of your program.
  • Line editing - JLine allows full editing of the current command line and attempts to mimic as much of the behavior of GNU Readline as possible, including support for both emacs and vi key mappings.
  • Completion - JLine provides a pluggable mechanism for implementing command line tab completion (of course completion can be bound to any key you wish).
  • Custom Key bindings - Keys may be arbitrarily remapped to perform a specific action, and JLine attempts to honor any mapping that is set in your existing readline .inputrc file.
  • Character Masking - Input may be gathered from the user without any visual feedback. This is useful for prompting for passwords.
  • 99.99% Java - The vast portion of JLine is all Java, using only some small bit of native code, provided by the Jansi project, to
    support Windows.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!