2022-08-28 13:21:57 +02:00
|
|
|
// Package serve provides the serve command.
|
2016-12-06 18:00:24 +00:00
|
|
|
package serve
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2019-07-28 18:47:38 +01:00
|
|
|
"github.com/rclone/rclone/cmd"
|
2016-12-06 18:00:24 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cmd.Root.AddCommand(Command)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Command definition for cobra
|
|
|
|
var Command = &cobra.Command{
|
|
|
|
Use: "serve <protocol> [opts] <remote>",
|
|
|
|
Short: `Serve a remote over a protocol.`,
|
2022-06-19 19:18:14 +02:00
|
|
|
Long: `Serve a remote over a given protocol. Requires the use of a
|
|
|
|
subcommand to specify the protocol, e.g.
|
2016-12-06 18:00:24 +00:00
|
|
|
|
|
|
|
rclone serve http remote:
|
|
|
|
|
|
|
|
Each subcommand has its own options which you can see in their help.
|
|
|
|
`,
|
2022-11-26 23:40:49 +01:00
|
|
|
Annotations: map[string]string{
|
|
|
|
"versionIntroduced": "v1.39",
|
|
|
|
},
|
2016-12-06 18:00:24 +00:00
|
|
|
RunE: func(command *cobra.Command, args []string) error {
|
|
|
|
if len(args) == 0 {
|
2020-10-13 17:49:58 -04:00
|
|
|
return errors.New("serve requires a protocol, e.g. 'rclone serve http remote:'")
|
2016-12-06 18:00:24 +00:00
|
|
|
}
|
|
|
|
return errors.New("unknown protocol")
|
|
|
|
},
|
|
|
|
}
|