github.com/tiagovtristao/plz@v13.4.0+incompatible/src/output/print_bootstrap.go (about) 1 // +build bootstrap 2 3 package output 4 5 import ( 6 "fmt" 7 "os" 8 "regexp" 9 "strings" 10 11 "github.com/thought-machine/please/src/cli" 12 ) 13 14 // Used to strip the formatting stuff at bootstrap time. 15 var stripFormatting = regexp.MustCompile(`\$\{[^\}]+\}`) 16 17 // printf is the bootstrap version with some niceties to handle the custom escape sequences. 18 func printf(format string, args ...interface{}) { 19 msg := strings.Replace(fmt.Sprintf(format, args...), "${ERASE_AFTER}", "\x1b[K", -1) 20 msg = stripFormatting.ReplaceAllString(msg, "") 21 fmt.Fprint(os.Stderr, cli.StripAnsi.ReplaceAllString(msg, "")) 22 }