github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/cmd/authorize/authorize.go (about) 1 package authorize 2 3 import ( 4 "github.com/rclone/rclone/cmd" 5 "github.com/rclone/rclone/fs/config" 6 "github.com/rclone/rclone/fs/config/flags" 7 "github.com/spf13/cobra" 8 ) 9 10 var ( 11 noAutoBrowser bool 12 ) 13 14 func init() { 15 cmd.Root.AddCommand(commandDefinition) 16 cmdFlags := commandDefinition.Flags() 17 flags.BoolVarP(cmdFlags, &noAutoBrowser, "auth-no-open-browser", "", false, "Do not automatically open auth link in default browser") 18 } 19 20 var commandDefinition = &cobra.Command{ 21 Use: "authorize", 22 Short: `Remote authorization.`, 23 Long: ` 24 Remote authorization. Used to authorize a remote or headless 25 rclone from a machine with a browser - use as instructed by 26 rclone config. 27 28 Use the --auth-no-open-browser to prevent rclone to open auth 29 link in default browser automatically.`, 30 Run: func(command *cobra.Command, args []string) { 31 cmd.CheckArgs(1, 3, command, args) 32 config.Authorize(args, noAutoBrowser) 33 }, 34 }