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 <iko...@gmail.com> wrote:

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-signature&_ts=owk41)   
[owk41]

On September 19, 2020 at 19:46 GMT, Alexander Mills 
<alexander.d.mi...@gmail.com> wrote:

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.Fprint(os.Stdout,"\033[y;0H")
//fmt.Fprint(os.Stdout, "\033[K")
//fmt.Print("\x1b[2k") // erase the current line

}

I tried all those ANSI codes, nothing quite worked?

On Saturday, September 19, 2020 at 12:36:04 PM UTC-7 iko...@gmail.com wrote:

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 <al...@channelmeter.com> wrote:

Yeah I tried all those ANSI codes, nothing seems to work :(

On Sat, Sep 19, 2020 at 11:59 AM Joop Kiefte <iko...@gmail.com> wrote:

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 <al...@channelmeter.com> wrote:

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 figure out how to do this with Golang, anyone 
know?

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/d52c998b-bc1e-46fa-901d-f3f992ef4918n%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/d52c998b-bc1e-46fa-901d-f3f992ef4918n%40googlegroups.com?utm_medium=email&utm_source=footer).

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/fe78a2dc-1d64-4502-ad3a-8a9e5ff0380fn%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/fe78a2dc-1d64-4502-ad3a-8a9e5ff0380fn%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c-64693-kfa3qrhp-p6wizg%3Dgt0uud%402.gethop.com.

Reply via email to