2018-03-05 19:44:16 +08:00
// Package rcflags implements command line flags to set up the remote control
package rcflags
import (
2019-07-29 01:47:38 +08:00
"github.com/rclone/rclone/cmd/serve/httplib/httpflags"
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/fs/rc"
2018-03-05 19:44:16 +08:00
"github.com/spf13/pflag"
)
// Options set by command line flags
var (
Opt = rc . DefaultOpt
)
// AddFlags adds the remote control flags to the flagSet
func AddFlags ( flagSet * pflag . FlagSet ) {
2018-10-28 06:58:18 +08:00
rc . AddOption ( "rc" , & Opt )
2018-03-05 19:44:16 +08:00
flags . BoolVarP ( flagSet , & Opt . Enabled , "rc" , "" , false , "Enable the remote control server." )
2018-10-28 22:31:24 +08:00
flags . StringVarP ( flagSet , & Opt . Files , "rc-files" , "" , "" , "Path to local files to serve on the HTTP server." )
flags . BoolVarP ( flagSet , & Opt . Serve , "rc-serve" , "" , false , "Enable the serving of remote objects." )
2018-11-04 00:37:09 +08:00
flags . BoolVarP ( flagSet , & Opt . NoAuth , "rc-no-auth" , "" , false , "Don't require auth for certain methods." )
2019-08-06 03:36:21 +08:00
flags . BoolVarP ( flagSet , & Opt . WebUI , "rc-web-gui" , "" , false , "Launch WebGUI on localhost" )
2019-08-04 19:32:37 +08:00
flags . BoolVarP ( flagSet , & Opt . WebGUIUpdate , "rc-web-gui-update" , "" , false , "Update / Force update to latest version of web gui" )
2019-08-05 23:22:40 +08:00
flags . StringVarP ( flagSet , & Opt . WebGUIFetchURL , "rc-web-fetch-url" , "" , "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest" , "URL to fetch the releases for webgui." )
2019-08-08 12:56:58 +08:00
flags . StringVarP ( flagSet , & Opt . AccessControlAllowOrigin , "rc-allow-origin" , "" , "" , "Set the allowed origin for CORS." )
2018-03-05 19:44:16 +08:00
httpflags . AddFlagsPrefix ( flagSet , "rc-" , & Opt . HTTPOptions )
}