Skip to content

Commit

Permalink
Avoid adding newlines to output by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
itskingori committed Sep 23, 2017
1 parent bbe13e9 commit 54ca812
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions select.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}
Expand All @@ -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
}

Expand Down

0 comments on commit 54ca812

Please sign in to comment.