mirror of
https://github.com/rclone/rclone.git
synced 2025-01-25 07:39:13 +01:00
config: fix display of config choices with empty help text
This commit is contained in:
parent
b783f09fc6
commit
c504d97017
@ -111,14 +111,14 @@ func Choose(what string, kind string, choices, help []string, defaultValue strin
|
|||||||
attributes := []string{terminal.HiRedFg, terminal.HiGreenFg}
|
attributes := []string{terminal.HiRedFg, terminal.HiGreenFg}
|
||||||
for i, text := range choices {
|
for i, text := range choices {
|
||||||
var lines []string
|
var lines []string
|
||||||
if help != nil {
|
if help != nil && help[i] != "" {
|
||||||
parts := strings.Split(help[i], "\n")
|
parts := strings.Split(help[i], "\n")
|
||||||
lines = append(lines, parts...)
|
lines = append(lines, parts...)
|
||||||
|
lines = append(lines, fmt.Sprintf("(%s)", text))
|
||||||
}
|
}
|
||||||
lines = append(lines, fmt.Sprintf("(%s)", text))
|
|
||||||
pos := i + 1
|
pos := i + 1
|
||||||
terminal.WriteString(attributes[i%len(attributes)])
|
terminal.WriteString(attributes[i%len(attributes)])
|
||||||
if len(lines) == 1 {
|
if len(lines) == 0 {
|
||||||
fmt.Printf("%2d > %s\n", pos, text)
|
fmt.Printf("%2d > %s\n", pos, text)
|
||||||
} else {
|
} else {
|
||||||
mid := (len(lines) - 1) / 2
|
mid := (len(lines) - 1) / 2
|
||||||
|
Loading…
Reference in New Issue
Block a user