2016-08-05 18:12:27 +02:00
|
|
|
package authorize
|
|
|
|
|
|
|
|
import (
|
2019-07-28 19:47:38 +02:00
|
|
|
"github.com/rclone/rclone/cmd"
|
|
|
|
"github.com/rclone/rclone/fs/config"
|
2019-10-26 21:19:22 +02:00
|
|
|
"github.com/rclone/rclone/fs/config/flags"
|
2016-08-05 18:12:27 +02:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2019-10-26 21:19:22 +02:00
|
|
|
var (
|
|
|
|
noAutoBrowser bool
|
|
|
|
)
|
|
|
|
|
2016-08-05 18:12:27 +02:00
|
|
|
func init() {
|
2019-10-11 17:58:11 +02:00
|
|
|
cmd.Root.AddCommand(commandDefinition)
|
2019-10-26 21:19:22 +02:00
|
|
|
cmdFlags := commandDefinition.Flags()
|
|
|
|
flags.BoolVarP(cmdFlags, &noAutoBrowser, "auth-no-open-browser", "", false, "Do not automatically open auth link in default browser")
|
2016-08-05 18:12:27 +02:00
|
|
|
}
|
|
|
|
|
2019-10-11 17:58:11 +02:00
|
|
|
var commandDefinition = &cobra.Command{
|
2016-08-05 18:12:27 +02:00
|
|
|
Use: "authorize",
|
|
|
|
Short: `Remote authorization.`,
|
|
|
|
Long: `
|
|
|
|
Remote authorization. Used to authorize a remote or headless
|
|
|
|
rclone from a machine with a browser - use as instructed by
|
2019-10-26 21:19:22 +02:00
|
|
|
rclone config.
|
|
|
|
|
|
|
|
Use the --auth-no-open-browser to prevent rclone to open auth
|
|
|
|
link in default browser automatically.`,
|
2016-08-05 18:12:27 +02:00
|
|
|
Run: func(command *cobra.Command, args []string) {
|
|
|
|
cmd.CheckArgs(1, 3, command, args)
|
2019-10-26 21:19:22 +02:00
|
|
|
config.Authorize(args, noAutoBrowser)
|
2016-08-05 18:12:27 +02:00
|
|
|
},
|
|
|
|
}
|