2014-11-25 165 views
0

gradle build,我可以看到目前的流程是怎样的以下内容:最佳方式

# first is 
> Loading 
# and then change to 
> Configuring > 0/1 projects > root project 

我的问题是:如何输出电流的过程中一行不两行,例如:

# first is: 
> 0/46 download tasks are finished 
# and then change this line to 
> 1/46 downaload tasks are finished 

回答

0

您可以使用回车键\r转载在同一行,覆盖前面:

10.times { |i| print "\r#{i}/10 times"; sleep 1 } 
# => 5/10 times 
0

我使用https://github.com/paul/progress_bar宝石这样的任务。

输出看起来是这样的:

[#######################################       ] [ 59.00%] [00:06] 

而且你可以很容易地将其配置为您的需求。