1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-04 17:43:50 +00:00

lib/http: convert options to new style

There are still users of the old style options which haven't been
converted yet.
This commit is contained in:
Nick Craig-Wood
2024-07-08 16:22:48 +01:00
parent dce8317042
commit cf25ae69ad
3 changed files with 104 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/spf13/pflag"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/flags"
)
@@ -72,9 +73,16 @@ be used to render HTML based on specific conditions.
return buf.String()
}
// TemplateConfigInfo descripts the Options in use
var TemplateConfigInfo = fs.Options{{
Name: "template",
Default: "",
Help: "User-specified template",
}}
// TemplateConfig for the templating functionality
type TemplateConfig struct {
Path string
Path string `config:"template"`
}
// AddFlagsPrefix for the templating functionality
@@ -88,6 +96,9 @@ func AddTemplateFlagsPrefix(flagSet *pflag.FlagSet, prefix string, cfg *Template
}
// DefaultTemplateCfg returns a new config which can be customized by command line flags
//
// Note that this needs to be kept in sync with TemplateConfigInfo above and
// can be removed when all callers have been converted.
func DefaultTemplateCfg() TemplateConfig {
return TemplateConfig{}
}