2022-11-27 13:33:39 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
2023-08-14 19:19:39 +00:00
|
|
|
"github.com/thegeeklab/wp-git-action/git"
|
|
|
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
|
|
|
"github.com/urfave/cli/v2"
|
2022-11-27 13:33:39 +00:00
|
|
|
)
|
|
|
|
|
2023-08-14 19:19:39 +00:00
|
|
|
// Plugin implements provide the plugin implementation.
|
2022-11-27 13:33:39 +00:00
|
|
|
type Plugin struct {
|
2023-08-14 19:19:39 +00:00
|
|
|
*wp.Plugin
|
|
|
|
Settings *Settings
|
2022-11-27 13:33:39 +00:00
|
|
|
}
|
|
|
|
|
2023-08-14 19:19:39 +00:00
|
|
|
// Settings for the Plugin.
|
|
|
|
type Settings struct {
|
|
|
|
Action cli.StringSlice
|
|
|
|
SSHKey string
|
|
|
|
|
|
|
|
Netrc Netrc
|
|
|
|
Pages Pages
|
|
|
|
Repo git.Repository
|
|
|
|
}
|
|
|
|
|
|
|
|
type Netrc struct {
|
|
|
|
Machine string
|
|
|
|
Login string
|
|
|
|
Password string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Pages struct {
|
|
|
|
Directory string
|
|
|
|
Exclude cli.StringSlice
|
|
|
|
Delete bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func New(options wp.Options, settings *Settings) *Plugin {
|
|
|
|
p := &Plugin{}
|
|
|
|
|
|
|
|
options.Execute = p.run
|
|
|
|
|
|
|
|
p.Plugin = wp.New(options)
|
|
|
|
p.Settings = settings
|
|
|
|
|
|
|
|
return p
|
2022-11-27 13:33:39 +00:00
|
|
|
}
|