plugin-registry-github

Github installer for Plugin Registry

MIT License

Stars
0

Github installer for Plugin Registry

An installer for plugin-registry

Prerequisites

  • Go >= 1.18

Install

go get github.com/nhatthm/plugin-registry-github

Usage

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/[email protected]

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

Examples

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)
}

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Paypal donation

       or scan this