From 7b1ca716bf1db05c56a9370f57424ae59ed8651b Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sat, 10 Apr 2021 23:02:54 +0200 Subject: [PATCH] config: add touch command to ensure config exists at configured location (#5226) A new command `rclone config touch` which calls config.SaveConfig(). Useful during testing of configuration location things. It will ensure the config file exists and test that it is writable. --- cmd/config/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/config/config.go b/cmd/config/config.go index 88c8e937b..7e6f3fc23 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -22,6 +22,7 @@ func init() { cmd.Root.AddCommand(configCommand) configCommand.AddCommand(configEditCommand) configCommand.AddCommand(configFileCommand) + configCommand.AddCommand(configTouchCommand) configCommand.AddCommand(configShowCommand) configCommand.AddCommand(configDumpCommand) configCommand.AddCommand(configProvidersCommand) @@ -63,6 +64,15 @@ var configFileCommand = &cobra.Command{ }, } +var configTouchCommand = &cobra.Command{ + Use: "touch", + Short: `Ensure configuration file exists.`, + Run: func(command *cobra.Command, args []string) { + cmd.CheckArgs(0, 0, command, args) + config.SaveConfig() + }, +} + var configShowCommand = &cobra.Command{ Use: "show []", Short: `Print (decrypted) config file, or the config for a single remote.`,