rclone/cmd/config/config.go

49 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package config
import (
"fmt"
"os"
"github.com/ncw/rclone/cmd"
"github.com/ncw/rclone/fs"
"github.com/spf13/cobra"
)
func init() {
cmd.Root.AddCommand(commandDefintion)
}
var commandDefintion = &cobra.Command{
Use: "config [function]",
Short: `Enter an interactive configuration session.`,
Long: "`rclone config`" + `
enters an interactive configuration sessions where you can setup
new remotes and manage existing ones. You may also set or remove a password to
protect your configuration.
Additional functions:
* ` + "`rclone config edit`" + ` same as above
* ` + "`rclone config file`" + ` show path of configuration file in use
* ` + "`rclone config show`" + ` print (decrypted) config file
`,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 1, command, args)
if len(args) == 0 {
fs.EditConfig()
return
}
switch args[0] {
case "edit":
fs.EditConfig()
case "show":
fs.ShowConfig()
case "file":
fs.ShowConfigLocation()
default:
fmt.Fprintf(os.Stderr, "Unknown subcommand %q, %s only supports edit, show and file.\n", args[0], command.Name())
}
},
}