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

rclone config: when choosing from a list, allow the value to be entered

Nick Craig-Wood21928053608f
diff --git a/fs/config.go b/fs/config.go
index 7d88a1c3c..fbf345571 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -685,11 +685,11 @@ func Confirm() bool {
// Choose one of the defaults or type a new string if newOk is set
func Choose(what string, defaults, help []string, newOk bool) string {
- fmt.Printf("Choose a number from below")
+ valueDescripton := "an existing"
if newOk {
- fmt.Printf(", or type in your own value")
+ valueDescripton = "your own"
}
- fmt.Println()
+ fmt.Printf("Choose a number from below, or type in %s value\n", valueDescripton)
for i, text := range defaults {
var lines []string
if help != nil {
@@ -728,6 +728,11 @@ func Choose(what string, defaults, help []string, newOk bool) string {
if newOk {
return result
}
+ for _, v := range defaults {
+ if result == v {
+ return result
+ }
+ }
continue
}
if i >= 1 && i <= len(defaults) {