Package config reads, writes and edits the config file and deals with command line flags
const ( // ConfigToken is the key used to store the token under ConfigToken = "token" // ConfigClientID is the config key used to store the client id ConfigClientID = "client_id" // ConfigClientSecret is the config key used to store the client secret ConfigClientSecret = "client_secret" // ConfigAuthURL is the config key used to store the auth server endpoint ConfigAuthURL = "auth_url" // ConfigTokenURL is the config key used to store the token server endpoint ConfigTokenURL = "token_url" // ConfigAuthorize indicates that we just want "rclone authorize" ConfigAuthorize = "config_authorize" )
var ( // ConfigPath points to the config file ConfigPath = makeConfigPath() // CacheDir points to the cache directory. Users of this // should make a subdirectory and use MkdirAll() to create it // and any parents. CacheDir = makeCacheDir() // output of prompt for password PasswordPromptOutput = os.Stderr // If set to true, the configKey is obscured with obscure.Obscure and saved to a temp file when it is // calculated from the password. The path of that temp file is then written to the environment variable // `_RCLONE_CONFIG_KEY_FILE`. If `_RCLONE_CONFIG_KEY_FILE` is present, password prompt is skipped and `RCLONE_CONFIG_PASS` ignored. // For security reasons, the temp file is deleted once the configKey is successfully loaded. // This can be used to pass the configKey to a child process. PassConfigKeyForDaemonization = false )
ReadLine reads some input
Authorize is for remote authorization of headless machines.
It expects 1 or 3 arguments
rclone authorize "fs name" rclone authorize "fs name" "client id" "client secret"
ChangePassword will query the user twice for the named password. If the same password is entered it is returned.
Choose one of the defaults or type a new string if newOk is set
ChooseNumber asks the user to enter a number between min and max inclusive prompting them with what.
ChooseOption asks the user to choose an option
ChooseRemote chooses a remote name
Command - choose one
Confirm asks the user for Yes or No and returns true or false
If AutoConfirm is set, it will return true
ConfirmWithConfig asks the user for Yes or No and returns true or false.
If AutoConfirm is set, it will look up the value in m and return that, but if it isn't set then it will return the Default value passed in
CopyRemote copies a config section
CreateRemote creates a new remote with name, provider and a list of parameters which are key, value pairs. If update is set then it adds the new keys rather than replacing all of them.
DeleteRemote gets the user to delete a remote
Dump dumps all the config as a JSON file
DumpRcBlob dumps all the config as an unstructured blob suitable for the rc
DumpRcRemote dumps the config for a single remote
EditConfig edits the config file interactively
EditRemote gets the user to edit a remote
FileDeleteKey deletes the config key in the config file. It returns true if the key was deleted, or returns false if the section or key didn't exist.
FileGet gets the config key under section returning the default or empty string if not set.
It looks up defaults in the environment if they are present
FileGetFlag gets the config key under section returning the the value and true if found and or ("", false) otherwise
FileGetFresh reads the config key under section return the value or an error if the config file was not found or that value couldn't be read.
FileSections returns the sections in the config file including any defined by environment variables.
FileSet sets the key in section to value. It doesn't save the config file.
GetPassword asks the user for a password with the prompt given.
JSONListProviders prints all the providers and options in JSON format
LoadConfig loads the config file
MustFindByName finds the RegInfo for the remote name passed in or exits with a fatal error.
NewRemote make a new remote from its name
NewRemoteName asks the user for a name for a remote
OkRemote prints the contents of the remote and ask if it is OK
PasswordRemote adds the keyValues passed in to the remote of name. keyValues should be key, value pairs.
ReadPassword reads a password without echoing it to the terminal.
RemoteConfig runs the config helper for the remote if needed
RenameRemote renames a config section
SaveConfig calling function which saves configuration file. if saveConfig returns error trying again after sleep.
SetPassword will allow the user to modify the current configuration encryption settings.
SetValueAndSave sets the key to the value and saves just that value in the config file. It loads the old config file in from disk first and overwrites the given value only.
ShowConfig prints the (unencrypted) config options
ShowConfigLocation prints the location of the config file in use
ShowRemote shows the contents of the remote
ShowRemotes shows an overview of the config file
UpdateRemote adds the keyValues passed in to the remote of name. keyValues should be key, value pairs.
|configflags||Package configflags defines the flags used by rclone.|
|configmap||Package configmap provides an abstraction for reading and writing config|
|configstruct||Package configstruct parses unstructured maps into structures|
|flags||Package flags contains enhanced versions of spf13/pflag flag routines which will read from the environment also.|
|obscure||Package obscure contains the Obscure and Reveal commands|