File: sprintf.go

package info (click to toggle)
tml 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: makefile: 16
file content (11 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
package tml

import "fmt"

// Sprintf works like fmt.Sprintf, but adds the option of using tags to apply colour or text formatting to the written text. For example "<red>some red text</red>".
// A full list of tags is available here: https://github.com/liamg/tml
func Sprintf(input string, a ...interface{}) string {
	// parsing cannot fail as the reader/writer are simply for local strings
	format, _ := Parse(input)
	return fmt.Sprintf(format, a...)
}