From f3b442e810290f12a218f3841adbd9ba26f203f8 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 7 Jul 2018 12:56:03 +0200 Subject: [PATCH] add format title+alignment --- clifmt/symbols.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/clifmt/symbols.go b/clifmt/symbols.go index 24b56f2..d4d539d 100644 --- a/clifmt/symbols.go +++ b/clifmt/symbols.go @@ -4,6 +4,9 @@ import ( "fmt" ) +var title_index = 0 +var align_offset = 30 + func Warn(s ...string) string { if len(s) == 0 { return Color(31, "/!\\") @@ -18,3 +21,16 @@ func Info(s ...string) string { return fmt.Sprintf("%s %s", Info(), s[0]) } + +func Title(s string) { + title_index++ + fmt.Printf("\n%s (%d) %s %s\n", Color(33, ">>", false), title_index, s, Color(33, "<<", false)) + +} + +func Align(s string) { + fmt.Printf("%s", s) + for i := len(s); i < align_offset; i++ { + fmt.Printf(" ") + } +}