"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Add ability for FS to have a Config helper function run
Nick Craig-Wood1b3a49929bd4
diff --git a/fs/config.go b/fs/config.goindex 6321601be..01b5bc019 100644--- a/fs/config.go+++ b/fs/config.go@@ -150,6 +150,11 @@ func Command(commands []string) byte {}}+// Asks the user for Yes or No and returns true or false+func Confirm() bool {+ return Command([]string{"yYes", "nNo"}) == 'y'+}+// Choose one of the defaults or type a new string if newOk is setfunc Choose(what string, defaults, help []string, newOk bool) string {fmt.Printf("Choose a number from below")@@ -209,6 +214,22 @@ func OkRemote(name string) bool {return false}+// Runs the config helper for the remote if needed+func RemoteConfig(name string) {+ fmt.Printf("Remote config\n")+ fsName := ConfigFile.MustValue(name, "type")+ if fsName == "" {+ log.Fatalf("Couldn't find type of fs for %q", name)+ }+ f, err := Find(fsName)+ if err != nil {+ log.Fatalf("Didn't find filing system: %v", err)+ }+ if f.Config != nil {+ f.Config(name)+ }+}+// Make a new remotefunc NewRemote(name string) {fmt.Printf("What type of source is it?\n")@@ -225,6 +246,7 @@ func NewRemote(name string) {for _, option := range fs.Options {ConfigFile.SetValue(name, option.Name, option.Choose())}+ RemoteConfig(name)if OkRemote(name) {SaveConfig()return@@ -246,6 +268,7 @@ func EditRemote(name string) {ConfigFile.SetValue(name, key, newValue)}}+ RemoteConfig(name)if OkRemote(name) {break}diff --git a/fs/fs.go b/fs/fs.goindex e20e4b5eb..c76747967 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -20,6 +20,7 @@ var (type FsInfo struct {Name string // name of this fsNewFs func(string, string) (Fs, error) // create a new file system+ Config func(string) // function to call to help with configOptions []Option}