[go-nuts] Re: Is it possible to change the existing printline dynamically in golang?

2022-04-11 Thread Zhaoxun Yan
Thanks a log Amnon! :D 在2022年4月1日星期五 UTC+8 21:25:14 写道: > Yes, this is the murky world of ANSI escape codes. > Fortunately there are a whole load of libraries which do this for you... > Try https://github.com/cheggaaa/pb > or https://github.com/schollz/progressbar > or

[go-nuts] Re: Is it possible to change the existing printline dynamically in golang?

2022-04-01 Thread Amnon
Yes, this is the murky world of ANSI escape codes. Fortunately there are a whole load of libraries which do this for you... Try https://github.com/cheggaaa/pb or https://github.com/schollz/progressbar or github.com/vardius/progress-go On Friday, 1 April 2022 at 13:12:11 UTC+1 yan.z...@gmail.com

[go-nuts] Re: Is it possible to change the existing printline dynamically in golang?

2022-04-01 Thread Zhaoxun Yan
Got it: package main import( "fmt" "time" ) func main() { fmt.Printf("Hello") time.Sleep(time.Second) time.Sleep(time.Second) fmt.Printf("\r") fmt.Printf("World\n") } 在2022年4月1日星期五 UTC+8 15:34:08 写道: > You can use the ansi escape code if the target terminal supports it.

[go-nuts] Re: Is it possible to change the existing printline dynamically in golang?

2022-04-01 Thread Henry
You can use the ansi escape code if the target terminal supports it. Alternatively, you can use the carriage return '\r' and reprint the line. Note you may need to overwrite with empty space to delete the line before rewriting it. On Friday, April 1, 2022 at 12:38:37 PM UTC+7