2020-05-04 09:24:32 +02:00
|
|
|
package text
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2020-05-08 18:13:51 +02:00
|
|
|
|
|
|
|
"github.com/leonelquinteros/gotext"
|
2020-05-04 09:24:32 +02:00
|
|
|
)
|
|
|
|
|
2020-07-06 02:02:12 +02:00
|
|
|
const (
|
|
|
|
arrow = "==>"
|
|
|
|
smallArrow = " ->"
|
|
|
|
opSymbol = "::"
|
|
|
|
)
|
2020-05-04 09:24:32 +02:00
|
|
|
|
|
|
|
func OperationInfoln(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(cyan(opSymbol + " ")), boldCode}, a...)...)
|
|
|
|
fmt.Fprintln(os.Stdout, ResetCode)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func OperationInfo(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(cyan(opSymbol + " ")), boldCode}, a...)...)
|
|
|
|
fmt.Fprint(os.Stdout, ResetCode+" ")
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Info(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(green(arrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Infoln(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintln(os.Stdout, append([]interface{}{Bold(green(arrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Warn(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(yellow(smallArrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Warnln(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintln(os.Stdout, append([]interface{}{Bold(yellow(smallArrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Error(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stderr, append([]interface{}{Bold(red(smallArrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Errorln(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintln(os.Stderr, append([]interface{}{Bold(red(smallArrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func PrintInfoValue(str, value string) {
|
|
|
|
if value == "" {
|
2020-05-08 18:13:51 +02:00
|
|
|
value = gotext.Get("None")
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintf(os.Stdout, Bold("%-16s%s")+" %s\n", str, ":", value)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|