mirror of
https://github.com/charmbracelet/gum
synced 2024-06-03 22:32:16 +02: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 == "" {
|
if input == "" {
|
||||||
return errors.New("no options provided, see `gum choose --help`")
|
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.
|
// 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
|
var choices []string
|
||||||
if input, _ := stdin.Read(); input != "" {
|
if input, _ := stdin.Read(); input != "" {
|
||||||
input = strings.TrimSpace(input)
|
input = strings.TrimSuffix(input, "\n")
|
||||||
if input != "" {
|
if input != "" {
|
||||||
choices = strings.Split(input, "\n")
|
choices = strings.Split(input, "\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue