mirror of
https://github.com/rclone/rclone.git
synced 2025-01-31 17:44:46 +08:00
config: add ConfirmWithDefault to change the default on AutoConfig
This commit is contained in:
parent
e52ecba295
commit
8e625e0bc3
|
@ -539,14 +539,23 @@ func Command(commands []string) byte {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm asks the user for Yes or No and returns true or false
|
// ConfirmWithDefault asks the user for Yes or No and returns true or false.
|
||||||
func Confirm() bool {
|
//
|
||||||
|
// If AutoConfirm is set, it will return the Default value passed in
|
||||||
|
func ConfirmWithDefault(Default bool) bool {
|
||||||
if fs.Config.AutoConfirm {
|
if fs.Config.AutoConfirm {
|
||||||
return true
|
return Default
|
||||||
}
|
}
|
||||||
return Command([]string{"yYes", "nNo"}) == 'y'
|
return Command([]string{"yYes", "nNo"}) == 'y'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirm asks the user for Yes or No and returns true or false
|
||||||
|
//
|
||||||
|
// If AutoConfirm is set, it will return true
|
||||||
|
func Confirm() bool {
|
||||||
|
return ConfirmWithDefault(true)
|
||||||
|
}
|
||||||
|
|
||||||
// Choose one of the defaults or type a new string if newOk is set
|
// Choose one of the defaults or type a new string if newOk is set
|
||||||
func Choose(what string, defaults, help []string, newOk bool) string {
|
func Choose(what string, defaults, help []string, newOk bool) string {
|
||||||
valueDescripton := "an existing"
|
valueDescripton := "an existing"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user