Hello mates, I am trying to rewrite above any previous printed line on windows terminal. To do that I am thinking to move the cursor for any previous line and then print again above it.
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
)
func main() {
fmt.Println("line01")
fmt.Println("line02")
fmt.Println("line03")
fmt.Println("line04")
fmt.Println("line05")
fmt.Println("line06")
fmt.Println("line07")
fmt.Println("line08")
cmd := exec.Command("tput", "-S")
cmd.Stdin = bytes.NewBufferString("clear\ncup 5 2")
cmd.Stdout = os.Stdout
cmd.Run()
fmt.Println("Hello")
}
Nevertheless, looks like the code is not doing anything. Anyone knows how to do that?
This code does: Move the cursor to column 3, row 6, and display the word “Hello” .