From 398533211fc4afed6a037d1d1b37fea7970d7ec1 Mon Sep 17 00:00:00 2001 From: King'ori Maina Date: Sat, 23 Sep 2017 15:48:02 +0200 Subject: [PATCH] Avoid adding newlines to output by default When newlines are hardcoded in the library, all user's of this library are forced into that ui-design choice without a way to modify that behaviour. This way, user's can opt to add newlines as they wish ... in their own tools. --- ask.go | 4 ++-- select.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ask.go b/ask.go index 65c893b..3a7d1ec 100644 --- a/ask.go +++ b/ask.go @@ -62,7 +62,7 @@ func (i *UI) Ask(query string, opts *Options) (string, error) { break } - fmt.Fprintf(i.Writer, "Input must not be empty.\n\n") + fmt.Fprintf(i.Writer, "Input must not be empty.") continue } @@ -74,7 +74,7 @@ func (i *UI) Ask(query string, opts *Options) (string, error) { break } - fmt.Fprintf(i.Writer, "Failed to validate input string: %s\n\n", err) + fmt.Fprintf(i.Writer, "Failed to validate input string: %s", err) continue } diff --git a/select.go b/select.go index f334f65..ca3261f 100644 --- a/select.go +++ b/select.go @@ -87,7 +87,7 @@ func (i *UI) Select(query string, list []string, opts *Options) (string, error) break } - fmt.Fprintf(i.Writer, "Input must not be empty. Answer by a number.\n\n") + fmt.Fprintf(i.Writer, "Input must not be empty. Answer by a number.") continue } @@ -100,7 +100,7 @@ func (i *UI) Select(query string, list []string, opts *Options) (string, error) } fmt.Fprintf(i.Writer, - "%q is not a valid input. Answer by a number.\n\n", line) + "%q is not a valid input. Answer by a number.", line) continue } @@ -112,7 +112,7 @@ func (i *UI) Select(query string, list []string, opts *Options) (string, error) } fmt.Fprintf(i.Writer, - "%q is not a valid choice. Choose a number from 1 to %d.\n\n", + "%q is not a valid choice. Choose a number from 1 to %d.", line, len(list)) continue } @@ -125,7 +125,7 @@ func (i *UI) Select(query string, list []string, opts *Options) (string, error) break } - fmt.Fprintf(i.Writer, "Failed to validate input string: %s\n\n", err) + fmt.Fprintf(i.Writer, "Failed to validate input string: %s", err) continue }