Compare commits

..

No commits in common. "ba7c3ac52dd0f740c31dbacb688724463ec4d79b" and "ed2d941259430a8a0fc3802899f51efe1952cf7e" have entirely different histories.

2 changed files with 5 additions and 26 deletions

View file

@ -23,6 +23,7 @@ var (
func main() {
if err := run(); err != nil {
fmt.Fprintf(os.Stderr, "ERROR: %v.\n", err)
os.Exit(1)
}
}
@ -180,18 +181,13 @@ func run() error {
exe, ok := executorMap[command]
if !ok {
err := executor.UnknownCommandError{Command: command}
printer.PrintFailure(err.Error() + ".")
flag.Usage()
return err
return executor.UnknownCommandError{Command: command}
}
if err := executor.Execute(exe, args); err != nil {
printer.PrintFailure("(" + command + ") " + err.Error() + ".")
return err
return fmt.Errorf("(%s) %w", command, err)
}
return nil

View file

@ -12,10 +12,6 @@ import (
"time"
)
const (
minTerminalWidth = 40
)
type theme struct {
reset string
boldblue string
@ -23,8 +19,6 @@ type theme struct {
green string
boldgreen string
grey string
red string
boldred string
}
type Printer struct {
@ -53,12 +47,6 @@ func NewPrinter(
green: "\033[32m",
boldgreen: "\033[32;1m",
grey: "\033[90m",
red: "\033[31m",
boldred: "\033[31;1m",
}
if maxTerminalWidth < minTerminalWidth {
maxTerminalWidth = minTerminalWidth
}
return &Printer{
@ -77,7 +65,7 @@ func NewPrinter(
}
func (p Printer) PrintSuccess(text string) {
success := p.theme.boldgreen + p.successSymbol + p.theme.reset
success := p.theme.green + p.successSymbol + p.theme.reset
if p.noColor {
success = p.successSymbol
}
@ -86,12 +74,7 @@ func (p Printer) PrintSuccess(text string) {
}
func (p Printer) PrintFailure(text string) {
failure := p.theme.boldred + p.failureSymbol + p.theme.reset
if p.noColor {
failure = p.failureSymbol
}
printToStderr(failure + " " + text + "\n")
printToStderr(p.failureSymbol + " " + text)
}
func (p Printer) PrintInfo(text string) {