Documentation
¶
Overview ¶
Package config reads, writes and edits the config file and deals with command line flags
Index ¶
- Constants
- Variables
- func Authorize(args []string)
- func ChangePassword(name string) string
- func Choose(what string, defaults, help []string, newOk bool) string
- func ChooseNumber(what string, min, max int) int
- func ChooseOption(o *fs.Option) string
- func ChooseRemote() string
- func Command(commands []string) byte
- func Confirm() bool
- func CopyRemote(name string)
- func CreateRemote(name string, provider string, keyValues []string) error
- func DeleteRemote(name string)
- func Dump() error
- func EditConfig()
- func EditRemote(fs *fs.RegInfo, name string)
- func FileDeleteKey(section, key string) bool
- func FileGet(section, key string, defaultVal ...string) string
- func FileGetBool(section, key string, defaultVal ...bool) bool
- func FileGetInt(section, key string, defaultVal ...int) int
- func FileSections() []string
- func FileSet(section, key, value string)
- func GetPassword(prompt string) string
- func JSONListProviders() error
- func LoadConfig()
- func MustFindByName(name string) *fs.RegInfo
- func MustObscure(x string) string
- func MustReveal(x string) string
- func NewRemote(name string)
- func NewRemoteName() (name string)
- func Obscure(x string) (string, error)
- func OkRemote(name string) bool
- func PasswordRemote(name string, keyValues []string) error
- func ReadPassword() string
- func RemoteConfig(name string)
- func RenameRemote(name string)
- func Reveal(x string) (string, error)
- func SaveConfig()
- func SetPassword()
- func SetValueAndSave(name, key, value string) (err error)
- func ShowConfig()
- func ShowConfigLocation()
- func ShowRemote(name string)
- func ShowRemotes()
- func UpdateRemote(name string, keyValues []string) error
Constants ¶
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" // ConfigAutomatic indicates that we want non-interactive configuration ConfigAutomatic = "config_automatic" )
Variables ¶
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() )
Global
var ReadLine = func() string { buf := bufio.NewReader(os.Stdin) line, err := buf.ReadString('\n') if err != nil { log.Fatalf("Failed to read line: %v", err) } return strings.TrimSpace(line) }
ReadLine reads some input
Functions ¶
func Authorize ¶
func Authorize(args []string)
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"
func ChangePassword ¶
ChangePassword will query the user twice for the named password. If the same password is entered it is returned.
func ChooseNumber ¶
ChooseNumber asks the user to enter a number between min and max inclusive prompting them with what.
func ChooseOption ¶
ChooseOption asks the user to choose an option
func CreateRemote ¶
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.
func EditRemote ¶
EditRemote gets the user to edit a remote
func FileDeleteKey ¶
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.
func FileGet ¶
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
func FileGetBool ¶
FileGetBool gets the config key under section returning the default or false if not set.
It looks up defaults in the environment if they are present
func FileGetInt ¶
FileGetInt gets the config key under section returning the default or 0 if not set.
It looks up defaults in the environment if they are present
func FileSections ¶
func FileSections() []string
FileSections returns the sections in the config file including any defined by environment variables.
func FileSet ¶
func FileSet(section, key, value string)
FileSet sets the key in section to value. It doesn't save the config file.
func GetPassword ¶
GetPassword asks the user for a password with the prompt given.
func JSONListProviders ¶
func JSONListProviders() error
JSONListProviders prints all the providers and options in JSON format
func MustFindByName ¶
MustFindByName finds the RegInfo for the remote name passed in or exits with a fatal error.
func MustObscure ¶
MustObscure obscures a value, exiting with a fatal error if it failed
func MustReveal ¶
MustReveal reveals an obscured value, exiting with a fatal error if it failed
func NewRemoteName ¶
func NewRemoteName() (name string)
NewRemoteName asks the user for a name for a remote
func PasswordRemote ¶
PasswordRemote adds the keyValues passed in to the remote of name. keyValues should be key, value pairs.
func ReadPassword ¶
func ReadPassword() string
ReadPassword reads a password without echoing it to the terminal.
func RemoteConfig ¶
func RemoteConfig(name string)
RemoteConfig runs the config helper for the remote if needed
func SaveConfig ¶
func SaveConfig()
SaveConfig saves configuration file. if configKey has been set, the file will be encrypted.
func SetPassword ¶
func SetPassword()
SetPassword will allow the user to modify the current configuration encryption settings.
func SetValueAndSave ¶
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.
func ShowConfigLocation ¶
func ShowConfigLocation()
ShowConfigLocation prints the location of the config file in use
func UpdateRemote ¶
UpdateRemote adds the keyValues passed in to the remote of name. keyValues should be key, value pairs.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package configflags defines the flags used by rclone.
|
Package configflags defines the flags used by rclone. |
Package flags contains enahnced versions of spf13/pflag flag routines which will read from the environment also.
|
Package flags contains enahnced versions of spf13/pflag flag routines which will read from the environment also. |