2023-12-22 23:59:23 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/thegeeklab/wp-git-clone/git"
|
|
|
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Plugin implements provide the plugin.
|
|
|
|
type Plugin struct {
|
|
|
|
*wp.Plugin
|
|
|
|
Settings *Settings
|
|
|
|
}
|
|
|
|
|
|
|
|
type Netrc struct {
|
|
|
|
Machine string
|
|
|
|
Login string
|
|
|
|
Password string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Settings for the plugin.
|
|
|
|
type Settings struct {
|
|
|
|
Depth int
|
|
|
|
Recursive bool
|
|
|
|
Tags bool
|
|
|
|
Lfs bool
|
|
|
|
Partial bool
|
|
|
|
Filter string
|
|
|
|
UseSSH bool
|
|
|
|
SSHKey string
|
2023-12-23 15:12:56 +00:00
|
|
|
Home string
|
2023-12-22 23:59:23 +00:00
|
|
|
WorkDir string
|
|
|
|
|
2023-12-23 20:46:36 +00:00
|
|
|
Netrc Netrc
|
|
|
|
Repo git.Repository
|
2023-12-22 23:59:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func New(options wp.Options, settings *Settings) *Plugin {
|
|
|
|
p := &Plugin{}
|
|
|
|
|
2024-04-22 18:46:46 +00:00
|
|
|
if options.Execute == nil {
|
|
|
|
options.Execute = p.run
|
|
|
|
}
|
2023-12-22 23:59:23 +00:00
|
|
|
|
|
|
|
p.Plugin = wp.New(options)
|
|
|
|
p.Settings = settings
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|