Add sync command
This commit is contained in:
commit
5e6a5e23fd
18 changed files with 1077 additions and 0 deletions
61
app/console_output.go
Normal file
61
app/console_output.go
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
colorReset = "\033[0m"
|
||||
colorRed = "\033[31m"
|
||||
colorGreen = "\033[32m"
|
||||
colorYellow = "\033[33m"
|
||||
colorBlue = "\033[34m"
|
||||
)
|
||||
|
||||
type ConsoleOutput struct {
|
||||
Color bool
|
||||
}
|
||||
|
||||
func (co ConsoleOutput) ErrorfMsg(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
if co.Color {
|
||||
msg = fmt.Sprintf("%vError:%v %v", colorRed, colorReset, msg)
|
||||
} else {
|
||||
msg = fmt.Sprintf("Error: %v", msg)
|
||||
}
|
||||
fmt.Println(msg)
|
||||
}
|
||||
|
||||
func (co ConsoleOutput) InfoFMsg(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
if co.Color {
|
||||
msg = fmt.Sprintf("%vInfo:%v %v", colorBlue, colorReset, msg)
|
||||
} else {
|
||||
msg = fmt.Sprintf("Info: %v", msg)
|
||||
}
|
||||
fmt.Println(msg)
|
||||
}
|
||||
|
||||
func (co ConsoleOutput) UnchangedStatusF(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
if co.Color {
|
||||
msg = fmt.Sprintf("%v%v", colorGreen, msg)
|
||||
}
|
||||
fmt.Println(msg)
|
||||
}
|
||||
|
||||
func (co ConsoleOutput) ChangedStatusF(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
if co.Color {
|
||||
msg = fmt.Sprintf("%v%v", colorYellow, msg)
|
||||
}
|
||||
fmt.Println(msg)
|
||||
}
|
||||
|
||||
func (co ConsoleOutput) ErrorStatusF(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
if co.Color {
|
||||
msg = fmt.Sprintf("%v%v", colorRed, msg)
|
||||
}
|
||||
fmt.Println(msg)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue