6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 20:19:42 +00:00
Files
git-get/pkg/print/print.go
Grzegorz Dlugoszewski 539c3beb90 Load repos status simultaneously with goroutines
Also, refactor printer interface.
2020-06-25 12:53:27 +02:00

36 lines
709 B
Go

package print
import "fmt"
const (
head = "HEAD"
)
// Printable represents a repository which status can be printed
type Printable interface {
Path() string
Current() string
Branches() []string
BranchStatus(string) string
WorkTreeStatus() string
Remote() string
Errors() []string
}
// TODO: not sure if this works on windows. See https://github.com/mattn/go-colorable
func red(str string) string {
return fmt.Sprintf("\033[1;31m%s\033[0m", str)
}
func green(str string) string {
return fmt.Sprintf("\033[1;32m%s\033[0m", str)
}
func blue(str string) string {
return fmt.Sprintf("\033[1;34m%s\033[0m", str)
}
func yellow(str string) string {
return fmt.Sprintf("\033[1;33m%s\033[0m", str)
}