forked from TrueCloudLab/rclone
Add --auto-confirm flag
This commit is contained in:
parent
682b4d54c5
commit
7749157596
1 changed files with 8 additions and 0 deletions
|
@ -104,6 +104,7 @@ var (
|
||||||
disableFeatures = StringP("disable", "", "", "Disable a comma separated list of features. Use help to see a list.")
|
disableFeatures = StringP("disable", "", "", "Disable a comma separated list of features. Use help to see a list.")
|
||||||
userAgent = StringP("user-agent", "", "rclone/"+Version, "Set the user-agent to a specified string. The default is rclone/ version")
|
userAgent = StringP("user-agent", "", "rclone/"+Version, "Set the user-agent to a specified string. The default is rclone/ version")
|
||||||
immutable = BoolP("immutable", "", false, "Do not modify files. Fail if existing files have been modified.")
|
immutable = BoolP("immutable", "", false, "Do not modify files. Fail if existing files have been modified.")
|
||||||
|
autoConfirm = BoolP("auto-confirm", "", false, "If enabled, do not request console confirmation.")
|
||||||
streamingUploadCutoff = SizeSuffix(100 * 1024)
|
streamingUploadCutoff = SizeSuffix(100 * 1024)
|
||||||
logLevel = LogLevelNotice
|
logLevel = LogLevelNotice
|
||||||
statsLogLevel = LogLevelInfo
|
statsLogLevel = LogLevelInfo
|
||||||
|
@ -243,6 +244,7 @@ type ConfigInfo struct {
|
||||||
BindAddr net.IP
|
BindAddr net.IP
|
||||||
DisableFeatures []string
|
DisableFeatures []string
|
||||||
Immutable bool
|
Immutable bool
|
||||||
|
AutoConfirm bool
|
||||||
StreamingUploadCutoff SizeSuffix
|
StreamingUploadCutoff SizeSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,6 +385,7 @@ func LoadConfig() {
|
||||||
Config.TPSLimit = *tpsLimit
|
Config.TPSLimit = *tpsLimit
|
||||||
Config.TPSLimitBurst = *tpsLimitBurst
|
Config.TPSLimitBurst = *tpsLimitBurst
|
||||||
Config.Immutable = *immutable
|
Config.Immutable = *immutable
|
||||||
|
Config.AutoConfirm = *autoConfirm
|
||||||
Config.BufferSize = bufferSize
|
Config.BufferSize = bufferSize
|
||||||
Config.StreamingUploadCutoff = streamingUploadCutoff
|
Config.StreamingUploadCutoff = streamingUploadCutoff
|
||||||
|
|
||||||
|
@ -805,6 +808,9 @@ func Command(commands []string) byte {
|
||||||
|
|
||||||
// Confirm asks the user for Yes or No and returns true or false
|
// Confirm asks the user for Yes or No and returns true or false
|
||||||
func Confirm() bool {
|
func Confirm() bool {
|
||||||
|
if Config.AutoConfirm {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return Command([]string{"yYes", "nNo"}) == 'y'
|
return Command([]string{"yYes", "nNo"}) == 'y'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,6 +1022,8 @@ func UpdateRemote(name string, keyValues []string) error {
|
||||||
// parameters which are key, value pairs. If update is set then it
|
// parameters which are key, value pairs. If update is set then it
|
||||||
// adds the new keys rather than replacing all of them.
|
// adds the new keys rather than replacing all of them.
|
||||||
func CreateRemote(name string, provider string, keyValues []string) error {
|
func CreateRemote(name string, provider string, keyValues []string) error {
|
||||||
|
// Suppress Confirm
|
||||||
|
Config.AutoConfirm = true
|
||||||
// Delete the old config if it exists
|
// Delete the old config if it exists
|
||||||
configData.DeleteSection(name)
|
configData.DeleteSection(name)
|
||||||
// Set the type
|
// Set the type
|
||||||
|
|
Loading…
Reference in a new issue