mirror of
https://github.com/charmbracelet/gum.git
synced 2024-10-26 15:20:05 +03:00
fix: trim only trailing newline, space may be intentional
This commit is contained in:
parent
7756c809d1
commit
c8e6b4a9d5
@ -29,7 +29,7 @@ func (o Options) Run() error {
|
||||
if input == "" {
|
||||
return errors.New("no options provided, see `gum choose --help`")
|
||||
}
|
||||
o.Options = strings.Split(strings.TrimSpace(input), "\n")
|
||||
o.Options = strings.Split(strings.TrimSuffix(input, "\n"), "\n")
|
||||
}
|
||||
|
||||
// We don't need to display prefixes if we are only picking one option.
|
||||
|
@ -33,7 +33,7 @@ func (o Options) Run() error {
|
||||
|
||||
var choices []string
|
||||
if input, _ := stdin.Read(); input != "" {
|
||||
input = strings.TrimSpace(input)
|
||||
input = strings.TrimSuffix(input, "\n")
|
||||
if input != "" {
|
||||
choices = strings.Split(input, "\n")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user