Re: [go-nuts] How to clear current line in terminal

2020-11-16 Thread Stephen Illingworth
This is how I would do it. Note that you must be careful not to insert newlines. If you do, terminal control becomes trickier. package main import "fmt" // ClearLine is the CSI sequence to clear the entire of the current line. const ClearLine = "\033[2K" func main() { // print a string

Re: [go-nuts] How to clear current line in terminal

2020-11-15 Thread Stephan Lukits
On 9/19/20 10:45 AM, Alex Mills wrote: [...] this will clear the current line in the terminal, so I can achieve something like a status line, but I cannot figure out how to do this with Golang, anyone know? https://play.golang.org/p/B5ZShtSizEy -- You received this message because you are su

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Joop Kiefte
func clearCurrentLine(){ fmt.Print("\n\033[1A\033[K") } [Joop Kiefte - Chat @ Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=owk7j) [owk7j] On September 19, 2020 at 20:04 GMT, Joop Kiefte wrote: package main import "fmt" func main() { fmt.Println("Test 1") fmt.Println("T

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Joop Kiefte
package main import "fmt" func main() { fmt.Println("Test 1") fmt.Println("Test 2") fmt.Print("\033[1A\033[K") //one up, remove line (should work after the newline of the Println) } Maybe this piece of code helps you? [Joop Kiefte - Chat @ Spike](https://spikenow.com/r/a/?ref=spike-organic-si

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Alexander Mills
Yeah sure so it looks like: clearCurrentLine() // clears the previous status line fmt.Println("foo") writeStatusLine() // writes new status line where clearCurrentLine() is just like func clearCurrentLine(){ //fmt.Printf("\033[0;") // clear current line //fmt.Printf("\033[2K\r%d",0); //fmt.Fp

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Joop Kiefte
Can you give some example code? [Joop Kiefte - Chat @ Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=owiru) [owiru] On September 19, 2020 at 19:29 GMT, Alex Mills wrote: Yeah I tried all those ANSI codes, nothing seems to work :( On Sat, Sep 19, 2020 at 11:59 AM Joop Kief

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Alex Mills
Yeah I tried all those ANSI codes, nothing seems to work :( On Sat, Sep 19, 2020 at 11:59 AM Joop Kiefte wrote: > I tend to do that with ANSI terminal codes, there are pages that explain > all codes > > *Joop Kiefte* - Chat @ Spike >

Re: [go-nuts] How to clear current line in terminal

2020-09-19 Thread Joop Kiefte
I tend to do that with ANSI terminal codes, there are pages that explain all codes [Joop Kiefte - Chat @ Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=owh4j) [owh4j] On September 19, 2020 at 18:44 GMT, Alex Mills wrote: Using Node.js with several projects I can use these

[go-nuts] How to clear current line in terminal

2020-09-19 Thread Alex Mills
Using Node.js with several projects I can use these: const rl = require('readline'); process.stdout.write('current line') rl.clearLine(process.stdout); rl.cursorTo(process.stdout, 0); this will clear the current line in the terminal, so I can achieve something like a status line, but I cannot f