mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
rclone config: when choosing from a list, allow the value to be entered
This commit is contained in:
parent
db0b93c0ad
commit
2192805360
11
fs/config.go
11
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user