github.com/decred/politeia@v1.4.0/politeiad/cmd/legacypoliteia/print.go (about)

     1  // Copyright (c) 2022 The Decred developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import "fmt"
     8  
     9  // printInPlace prints the provided text to stdout in a way that overwrites the
    10  // existing stdout text. This function can be called multiple times. Each
    11  // subsequent call will overwrite the existing text that was printed to stdout.
    12  func printInPlace(s string) {
    13  	fmt.Printf("\033[2K\r%s", s)
    14  }