From b1c9eb0e01b5bf8591da17fec621a99a53cced85 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 20 Jul 2018 00:49:02 +0200 Subject: [PATCH] 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. --- cmd/logger/logger.go | 17 ++--------------- cmd/ui-errors.go | 4 ++-- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/cmd/logger/logger.go b/cmd/logger/logger.go index 53b218b7c..b5661cbf6 100644 --- a/cmd/logger/logger.go +++ b/cmd/logger/logger.go @@ -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 } } diff --git a/cmd/ui-errors.go b/cmd/ui-errors.go index 005243cbd..ae244b46e 100644 --- a/cmd/ui-errors.go +++ b/cmd/ui-errors.go @@ -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(