MCPcopy
hub / github.com/pocketbase/pocketbase / Register

Function Register

plugins/ghupdate/ghupdate.go:72–108  ·  view source on GitHub ↗

Register registers the ghupdate plugin to the provided app instance.

(app core.App, rootCmd *cobra.Command, config Config)

Source from the content-addressed store, hash-verified

70
71// Register registers the ghupdate plugin to the provided app instance.
72func Register(app core.App, rootCmd *cobra.Command, config Config) error {
73 p := &plugin{
74 app: app,
75 currentVersion: rootCmd.Version,
76 config: config,
77 }
78
79 if p.config.Owner == "" {
80 p.config.Owner = "pocketbase"
81 }
82
83 if p.config.Repo == "" {
84 p.config.Repo = "pocketbase"
85 }
86
87 if p.config.ArchiveExecutable == "" {
88 p.config.ArchiveExecutable = "pocketbase"
89 }
90
91 if p.config.BaseURL == "" {
92 p.config.BaseURL = "https://api.github.com"
93 } else {
94 p.config.BaseURL = strings.TrimRight(p.config.BaseURL, "/")
95 }
96
97 if p.config.HttpClient == nil {
98 p.config.HttpClient = http.DefaultClient
99 }
100
101 if p.config.Context == nil {
102 p.config.Context = context.Background()
103 }
104
105 rootCmd.AddCommand(p.updateCmd())
106
107 return nil
108}
109
110type plugin struct {
111 app core.App

Callers 1

MustRegisterFunction · 0.70

Calls 1

updateCmdMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…