cmd: re-use existing ui library

Also, move CLI-only utils into `cmd` rather than the top-level package.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-01-12 15:21:36 -08:00
parent bbdd2b394a
commit 49f0c0e149
6 changed files with 152 additions and 31 deletions

View File

@@ -1,26 +0,0 @@
package ui
import (
"fmt"
"os"
"strings"
)
func Fatalf(msg string, args ...interface{}) {
if !strings.HasSuffix(msg, "\n") {
msg += "\n"
}
fmt.Fprintf(os.Stderr, msg, args...)
os.Exit(1)
}
func Fatal(msg interface{}) {
Fatalf("%s\n", msg)
}
func Info(msg string, args ...interface{}) {
if !strings.HasSuffix(msg, "\n") {
msg += "\n"
}
fmt.Fprintf(os.Stderr, "[info] "+msg, args...)
}