refactor: rename options pkg to option

This commit is contained in:
lilong.129
2025-02-06 17:50:09 +08:00
parent b22f24cb6b
commit 194b61718f
61 changed files with 554 additions and 548 deletions
+55
View File
@@ -0,0 +1,55 @@
package option
import "github.com/httprunner/funplugin"
type DriverOptions struct {
Capabilities Capabilities
Plugin funplugin.IPlugin
WithImageService bool
WithResultFolder bool
WithUIAction bool
}
func NewDriverOptions(opts ...DriverOption) *DriverOptions {
driverOptions := &DriverOptions{
WithImageService: true,
WithResultFolder: true,
WithUIAction: true,
}
for _, option := range opts {
option(driverOptions)
}
return driverOptions
}
type DriverOption func(*DriverOptions)
func WithDriverCapabilities(capabilities Capabilities) DriverOption {
return func(options *DriverOptions) {
options.Capabilities = capabilities
}
}
func WithDriverImageService(withImageService bool) DriverOption {
return func(options *DriverOptions) {
options.WithImageService = withImageService
}
}
func WithDriverResultFolder(withResultFolder bool) DriverOption {
return func(options *DriverOptions) {
options.WithResultFolder = withResultFolder
}
}
func WithUIAction(withUIAction bool) DriverOption {
return func(options *DriverOptions) {
options.WithUIAction = withUIAction
}
}
func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption {
return func(options *DriverOptions) {
options.Plugin = plugin
}
}