Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Make config chooser easier to understand

Nick Craig-Wood95e4d837ef87
diff --git a/fs/config.go b/fs/config.go
index db6221657..404740317 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -571,13 +571,34 @@ func Choose(what string, defaults, help []string, newOk bool) string {
}
fmt.Println()
for i, text := range defaults {
+ var lines []string
if help != nil {
parts := strings.Split(help[i], "\n")
- for _, part := range parts {
- fmt.Printf(" * %s\n", part)
+ lines = append(lines, parts...)
+ }
+ lines = append(lines, fmt.Sprintf("%q", text))
+ pos := i + 1
+ if len(lines) == 1 {
+ fmt.Printf("%2d > %s\n", pos, text)
+ } else {
+ mid := (len(lines) - 1) / 2
+ for i, line := range lines {
+ var sep rune
+ switch i {
+ case 0:
+ sep = '/'
+ case len(lines) - 1:
+ sep = '\\'
+ default:
+ sep = '|'
+ }
+ number := " "
+ if i == mid {
+ number = fmt.Sprintf("%2d", pos)
+ }
+ fmt.Printf("%s %c %s\n", number, sep, line)
}
}
- fmt.Printf("%2d) %s\n", i+1, text)
}
for {
fmt.Printf("%s> ", what)