Categorygithub.com/nhatthm/plugin-registry-github
modulepackage
0.3.0
Repository: https://github.com/nhatthm/plugin-registry-github.git
Documentation: pkg.go.dev

# README

Github installer for Plugin Registry

GitHub Releases Build Status codecov Go Report Card GoDevDoc Donate

An installer for plugin-registry

Prerequisites

  • Go >= 1.16

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

paypal

       or scan this

# Packages

No description provided by the author

# Functions

NewInstaller initiates a new github installer.
RegisterInstaller registers the installer.
WithBaseURL sets the github base url.
WithFs sets the file system.
WithService sets the repository service.

# Variables

ErrArtifactNotFound indicates that the artifact is not found.
ErrMissingOwner indicates that there is no owner in the url.
ErrMissingRepository indicates that there is no repository in the url.
ErrNotGithub indicates the url is not github.

# Structs

Installer installs plugin from github.

# Interfaces

RepositoryService is a wrapper around *github.RepositoryService.

# Type aliases

Option is option to configure Installer.