[golang]golang如何覆盖输出console,实现进度条

package main
import(
"fmt"
"os"
"time"
)
func main(){
for i :=;i!=;i=i+{
fmt.Fprintf(os.Stdout,"result is %d\r",i)
time.Sleep(time.Second*)
}
fmt.Println("Over")
}

golang一个骚气的进度提示库
spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full examples in the examples directory.
For more detail about the library and its features, reference your local godoc once installed.
Contributions welcome!
安装
go get -u -v github.com/briandowns/spinner
下面是效果图
(Numbered by their slice index)
index |
character set |
sample gif |
0 |
←↖↑↗→↘↓↙ |
 |
1 |
▁▃▄▅▆▇█▇▆▅▄▃▁ |
 |
2 |
▖▘▝▗ |
 |
3 |
┤┘┴└├┌┬┐ |
 |
4 |
◢◣◤◥ |
 |
5 |
◰◳◲◱ |
 |
6 |
◴◷◶◵ |
 |
7 |
◐◓◑◒ |
 |
8 |
.oO@* |
 |
9 |
``` |
/-``` |
10 |
◡◡⊙⊙◠◠ |
 |
11 |
⣾⣽⣻⢿⡿⣟⣯⣷ |
 |
12 |
>))'> >))'> >))'> >))'> >))'> <'((< <'((< <'((< |
 |
13 |
⠁⠂⠄⡀⢀⠠⠐⠈ |
 |
14 |
⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏ |
 |
15 |
abcdefghijklmnopqrstuvwxyz |
 |
16 |
▉▊▋▌▍▎▏▎▍▌▋▊▉ |
 |
17 |
■□▪▫ |
 |
18 |
←↑→↓ |
 |
19 |
╫╪ |
 |
20 |
⇐⇖⇑⇗⇒⇘⇓⇙ |
 |
21 |
⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈ |
 |
22 |
⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈ |
 |
23 |
⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁ |
 |
24 |
⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋ |
 |
25 |
ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン |
 |
26 |
. .. ... |
 |
27 |
▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁ |
 |
28 |
.oO°Oo. |
 |
29 |
+x |
 |
30 |
v<^> |
 |
31 |
>>---> >>---> >>---> >>---> >>---> <---<< <---<< <---<< <---<< <---<< |
 |
32 |
``` |
|
33 |
[] [=] [==] [===] [====] [=====] [======] [=======] [========] [=========] [==========] |
 |
34 |
(*---------) (-*--------) (--*-------) (---*------) (----*-----) (-----*----) (------*---) (-------*--) (--------*-) (---------*) |
 |
35 |
█▒▒▒▒▒▒▒▒▒ ███▒▒▒▒▒▒▒ █████▒▒▒▒▒ ███████▒▒▒ ██████████ |
 |
36 |
[ ] [=> ] [===> ] [=====> ] [======> ] [========> ] [==========> ] [============> ] [==============> ] [================> ] [==================> ] [===================>] |
 |
37 |
- Android 电池电量进度条,上下滚动图片的进度条(battery)
最近,制作一个app,需要模拟一个电池电量的进度条,根据电量多少来设置百分比,进度条不断上下滚动,就像平时手机充电一样的电池电量进度条.我就自定义view实现了电量进度条.修改图片就可以达到自己想要的 ...
- COCOS2D-X之圆形进度条的一个简单Demo
这应该是游戏中很常见的一个效果.显示某个事件的进度等,在加载资源或者联网的时候经常用到.所以有必要学习学习 一.我们直接在COCOS2D-X自带的HelloCpp的工程中添加代码即可.我们在初始化中添 ...
- H5 可堆叠的圆环进度条,支持任意数量子进度条
by Conmajia SN: S22-W1M 由来 看到一篇帖子<vue实用组件--圆环百分比进度条>,让我想起了很多年前我在WinForm下仿制过的Chrome进度条. ▲ 原版进度条 ...
- C# 时间控件 竖直进度条 饼图显示 仪表盘 按钮基础控件库
Prepare 本文将使用一个NuGet公开的组件来实现一些特殊的控件显示,方便大家进行快速的开发系统. 在Visual Studio 中的NuGet管理器中可以下载安装,也可以直接在NuGet控制台 ...
- Java web实时进度条整个系统共用(如java上传、下载进度条、导入、导出excel进度条等)
先上图: 文件上传的: 2017-05-04再次改进.在上传过程中用户可以按 Esc 来取消上传(取消当前上传,或者是全部上传)... 2019-03-26更新进度条显示体验 从服务器上压缩下载: 从 ...
- wpf slider进度条的样式模板,带有进度颜色显示
效果图: 仅仅需在前台加上这段代码就可以: <UserControl.Resources> <!--笔刷--> <LinearGradientBrush x:Key=&q ...
- 用 Python 写出这样的进度条,刷新了我对进度条的认知
❞ 1 简介 很多人学习python,不知道从何学起.很多人学习python,掌握了基本语法过后,不知道在哪里寻找案例上手.很多已经做案例的人,却不知道如何去学习更加高深的知识.那么针对这三类人,我给 ...
- ios进度条Demo一个
一个很简单的Dmo.就拿出来分享一下. 一个简单的阴影效果 _progressView.frame = CGRectMake(size.width * progress-size.width, H_H ...
- 实现winfrom进度条及进度信息提示,winfrom程序假死处理
1.方法一:使用线程 功能描述:在用c#做WinFrom开发的过程中.我们经常需要用到进度条(ProgressBar)用于显示进度信息.这时候我们可能就需要用到多线程,如果不采用多线程控制进度条,窗口 ...
随机推荐
- Postman请求后台报错:Invalid character found in method name. HTTP method names must be tokens
在使用Postman请求后台时Postman出现 开发工具控制台报 信息: Error parsing HTTP request header Note: further occurrences of ...
- C++ | 使用const std::map,map::[]时遇到的一个bug
原函数简化后如下: void fun(const map<int,vector<int>> &mp, int index) { for (auto tmp : mp[i ...
- 【转载】C#中List集合使用Reverse方法对集合中的元素进行倒序反转
在C#的List集合操作中,有时候需要对List集合中的元素的顺序进行倒序反转操作,此时就可使用到List集合中的Reverse方法来实现此功能,Reverse方法的签名为void Reverse() ...
- SpringBoot+SpringCloud+vue+Element开发项目——数据库设计
1.用户表(sys_user) CREATE TABLE `sys_user` ( `id` ) NOT NULL AUTO_INCREMENT COMMENT '编号', `name` ) NOT ...
- WinServer-文件共享端口
When turning on Firewall, please assure that “File and Printer Sharing” on current network profile i ...
- thinkphp概述
thinkphp框架是一个免费的,开源,快速,简单的面向对象的轻量级PHP开发框架. 了解什么是thinkphp概述,thinkphp项目目录结构,thinkphp的控制器,视图,thinkphp项目 ...
- HAProxy-1.8.x版本源码编译
源码编译HAProxy: 官网下载HAProxy包,并解压包,切换到haproxy包目录下 [root@centos17haproxy-1.8.20]#tar xvf haproxy-1.8.20. ...
- [archlinux][tls] archlinux下使curl支持sslv3的方法
描述 在archlinux下,希望使用curl产生一条使用sslv3的https访问请求. 使用curl的如下命令: curl -k -vvv --sslv3 https://192.168.7.9: ...
- http通信示例Httpclient和HttpServer
本示例源于为朋友解决一个小问题,数据库到服务器的数据传输,由于本人能力有限,暂时将它理解为从数据库中获取数取表数据,实际上有可能是文件或者其他形式的数据,不过原理都得用流传输, 首先httpclien ...
- Apache 安装后Error 403的故障排错方法(linux)
Apache 安装后Error 403的故障排错方法 2018年01月07日 14:25:41 个人分类: Linux 一.问题描述 在apache2的httpd配置中,很多情况都会出现403. 刚安 ...
|