Update命令行应用现状 [英] Update command line application status

查看:109
本文介绍了Update命令行应用现状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在打印上升百分比的命令行应用程序。

I have a command line application that currently print a percentage being increased.

1%
2%
3%
4%
...

1% 2% 3% 4% ...

的输出是连续的。但我所看到的命令行工具,显示了变化,就好像它是在线更新

The output is sequential. But I have seen command lines tools that shows the changes as if it being update inline.

1%

2%在相同的位置与第一

2% In the same position as the first

3%在相同的位置与第一

3% In the same position as the first

4%在相同的位置与第一

4% In the same position as the first

¿我怎样才能做到这一点?我使用Java,如果该事项,并申请将在linux上运行。

¿How can I achieve this? I am using Java, if that matters, and the application will run on linux.

感谢您。

修改

和如何使用颜色?

推荐答案

输出 \\ r 打印更新之前,然后冲水。这将光标返回到第一列。

Output a \r before printing the update, then flush. This will return the cursor to the first column.

这篇关于Update命令行应用现状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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