Disable splitting lines in pretty error messages (#6171)

In a small window, UI error tries to split lines for an eye candy
error message. However, since we show some docs.minio.io links in some
error messages, these links are actually broken and not easily selected
in a X terminal. This PR changes the behavior and won't split lines
anymore.
This commit is contained in:
Anis Elleuch 2018-07-20 00:49:02 +02:00 committed by kannappanr
parent b8f4f26cf6
commit b1c9eb0e01
2 changed files with 4 additions and 17 deletions

View File

@ -28,7 +28,6 @@ import (
"time"
c "github.com/minio/mc/pkg/console"
"golang.org/x/crypto/ssh/terminal"
)
// Disable disables all logging, false by default. (used for "go test")
@ -441,13 +440,6 @@ var (
func (f fatalMsg) pretty(msg string, args ...interface{}) {
// Build the passed error message
errMsg := fmt.Sprintf(msg, args...)
// Check terminal width
termWidth, _, err := terminal.GetSize(0)
if err != nil || termWidth < minimumWidth {
termWidth = minimumWidth
}
// Calculate available widht without the banner
width := termWidth - bannerWidth
tagPrinted := false
@ -478,13 +470,8 @@ func (f fatalMsg) pretty(msg string, args ...interface{}) {
ansiRestoreAttributes()
ansiMoveRight(bannerWidth)
// Continue error message printing
if len(line) > width {
fmt.Println(line[:width])
line = line[width:]
} else {
fmt.Println(line)
break
}
fmt.Println(line)
break
}
}

View File

@ -19,8 +19,8 @@ package cmd
var (
uiErrInvalidConfig = newUIErrFn(
"Invalid value found in the configuration file",
"Please ensure a valid value in the configuration file, for more details refer https://docs.minio.io/docs/minio-server-configuration-guide",
"",
"Please ensure a valid value in the configuration file",
"For more details, refer to https://docs.minio.io/docs/minio-server-configuration-guide",
)
uiErrInvalidBrowserValue = newUIErrFn(