2018-03-05 11:44:16 +00:00
|
|
|
// Package rcflags implements command line flags to set up the remote control
|
|
|
|
package rcflags
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ncw/rclone/cmd/serve/httplib/httpflags"
|
|
|
|
"github.com/ncw/rclone/fs/config/flags"
|
|
|
|
"github.com/ncw/rclone/fs/rc"
|
|
|
|
"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-27 22:58:18 +00:00
|
|
|
rc.AddOption("rc", &Opt)
|
2018-03-05 11:44:16 +00:00
|
|
|
flags.BoolVarP(flagSet, &Opt.Enabled, "rc", "", false, "Enable the remote control server.")
|
2018-10-28 14:31:24 +00: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-03 16:37:09 +00:00
|
|
|
flags.BoolVarP(flagSet, &Opt.NoAuth, "rc-no-auth", "", false, "Don't require auth for certain methods.")
|
2018-03-05 11:44:16 +00:00
|
|
|
httpflags.AddFlagsPrefix(flagSet, "rc-", &Opt.HTTPOptions)
|
|
|
|
}
|