控制台应用程序中基于选项卡的自动完成 [英] Tab Based Autocomplete in Console App

查看:51
本文介绍了控制台应用程序中基于选项卡的自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个基于控制台的Java应用程序,在该应用程序中将向用户显示一个自定义命令提示符,她可以在其中键入某些命令,我​​想为该应用程序实现自动完成功能,如果用户键入该命令,按TAB键,然后命令应完成.该功能类似于Linux命令提示符中的自动完成.

I am writing a console based Java application in which the user will be presented a custom command prompts where she can type certain commands, I want to implement an auto complete feature for the app by which while typing the command, if the user presses TAB then the command should complete. The functionality is similar to auto complete in Linux command prompt.

在Java Console App中,我们无法控制TAB,默认情况下,按下TAB会追加8个空格.我需要一些技巧来使用TAB进行渲染,而我的应用可以用自动完成功能代替TAB.

In Java Console App we don't get the control over TAB and a TAB pressed will by default append 8 spaces. I need some trick using which the TAB doesn't go for rendering and my app can replace the TAB with autocomplete.

谢谢.

推荐答案

您可以尝试使用类似 Java-Readline jline2 .

You can try using a library like Java-Readline or jline2.

这篇关于控制台应用程序中基于选项卡的自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆