2018-03-05 12:44:16 +01:00
// Package rcflags implements command line flags to set up the remote control
package rcflags
import (
2019-07-28 19:47:38 +02:00
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/fs/rc"
2018-03-05 12:44:16 +01:00
"github.com/spf13/pflag"
)
2023-03-23 13:04:17 +01:00
// FlagPrefix is the prefix used to uniquely identify command line flags.
const FlagPrefix = "rc-"
2018-03-05 12:44:16 +01:00
// Options set by command line flags
var (
Opt = rc . DefaultOpt
)
// AddFlags adds the remote control flags to the flagSet
2023-03-23 13:04:17 +01:00
func AddFlags ( flagSet * pflag . FlagSet ) {
2018-10-28 00:58:18 +02:00
rc . AddOption ( "rc" , & Opt )
2021-08-16 11:30:01 +02:00
flags . BoolVarP ( flagSet , & Opt . Enabled , "rc" , "" , false , "Enable the remote control server" )
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" )
flags . BoolVarP ( flagSet , & Opt . NoAuth , "rc-no-auth" , "" , false , "Don't require auth for certain methods" )
2019-08-05 21:36:21 +02:00
flags . BoolVarP ( flagSet , & Opt . WebUI , "rc-web-gui" , "" , false , "Launch WebGUI on localhost" )
2020-01-12 10:12:04 +01:00
flags . BoolVarP ( flagSet , & Opt . WebGUIUpdate , "rc-web-gui-update" , "" , false , "Check and update to latest version of web gui" )
flags . BoolVarP ( flagSet , & Opt . WebGUIForceUpdate , "rc-web-gui-force-update" , "" , false , "Force update to latest version of web gui" )
flags . BoolVarP ( flagSet , & Opt . WebGUINoOpenBrowser , "rc-web-gui-no-open-browser" , "" , false , "Don't open the browser automatically" )
2021-08-16 11:30:01 +02: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" )
2020-02-26 09:34:32 +01:00
flags . BoolVarP ( flagSet , & Opt . EnableMetrics , "rc-enable-metrics" , "" , false , "Enable prometheus metrics on /metrics" )
2021-12-30 13:27:03 +01:00
flags . DurationVarP ( flagSet , & Opt . JobExpireDuration , "rc-job-expire-duration" , "" , Opt . JobExpireDuration , "Expire finished async jobs older than this value" )
flags . DurationVarP ( flagSet , & Opt . JobExpireInterval , "rc-job-expire-interval" , "" , Opt . JobExpireInterval , "Interval to check for expired async jobs" )
2023-03-23 13:04:17 +01:00
Opt . HTTP . AddFlagsPrefix ( flagSet , FlagPrefix )
Opt . Auth . AddFlagsPrefix ( flagSet , FlagPrefix )
Opt . Template . AddFlagsPrefix ( flagSet , FlagPrefix )
2018-03-05 12:44:16 +01:00
}