An installer for plugin-registry
Go >= 1.18
go get github.com/nhatthm/plugin-registry-github
Import the library while bootstrapping the application (see the examples)
The installer supports this source format: [https?://][www.]github.com/owner/repository[@version]
. For examples:
https://github.com/owner/repository
https://www.github.com/owner/repository
github.com/owner/repository@latest
github.com/owner/repository@v1.4.2
In the root folder of the repository, there must be a .plugin.registry.yaml
file that describe the plugin.
For example: https://github.com/nhatthm/moneylovercli-plugin-n26/blob/master/.plugin.registry.yaml
package mypackage
import (
"context"
registry "github.com/nhatthm/plugin-registry"
_ "github.com/nhatthm/plugin-registry-github" // Add file system installer.
)
var defaultRegistry = mustCreateRegistry()
func mustCreateRegistry() registry.Registry {
r, err := createRegistry()
if err != nil {
panic(err)
}
return r
}
func createRegistry() (registry.Registry, error) {
return registry.NewRegistry("~/plugins")
}
func installPlugin(url string) error {
return defaultRegistry.Install(context.Background(), url)
}
If this project help you reduce time to develop, you can give me a cup of coffee :)
or scan this