extensions

package
v0.18.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "tdl-"

Variables

View Source
var (
	ErrAlreadyUpToDate = errors.New("already up to date")
	ErrOnlyGitHub      = errors.New("only GitHub extension can be upgraded by tdl")
)
View Source
var ErrInvalidExtensionType = fmt.Errorf("not a valid ExtensionType, try [%s]", strings.Join(_ExtensionTypeNames, ", "))

Functions

func ExtensionTypeNames

func ExtensionTypeNames() []string

ExtensionTypeNames returns a list of possible string values of ExtensionType.

Types

type Extension

type Extension interface {
	Type() ExtensionType
	Name() string // Extension Name without tdl- prefix
	Path() string // Path to executable
	URL() string
	Owner() string
	CurrentVersion() string
	LatestVersion(ctx context.Context) string
	UpdateAvailable(ctx context.Context) bool
}

type ExtensionType

type ExtensionType string

ExtensionType ENUM(github, local)

const (
	// ExtensionTypeGithub is a ExtensionType of type github.
	ExtensionTypeGithub ExtensionType = "github"
	// ExtensionTypeLocal is a ExtensionType of type local.
	ExtensionTypeLocal ExtensionType = "local"
)

func ExtensionTypeValues

func ExtensionTypeValues() []ExtensionType

ExtensionTypeValues returns a list of the values for ExtensionType

func ParseExtensionType

func ParseExtensionType(name string) (ExtensionType, error)

ParseExtensionType attempts to convert a string to a ExtensionType.

func (*ExtensionType) Get

func (x *ExtensionType) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (ExtensionType) IsValid

func (x ExtensionType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (*ExtensionType) Set

func (x *ExtensionType) Set(val string) error

Set implements the Golang flag.Value interface func.

func (ExtensionType) String

func (x ExtensionType) String() string

String implements the Stringer interface.

func (*ExtensionType) Type

func (x *ExtensionType) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(dir string) *Manager

func (*Manager) Dispatch

func (m *Manager) Dispatch(ext Extension, args []string, env *extension.Env, stdin io.Reader, stdout, stderr io.Writer) (rerr error)

func (*Manager) DryRun

func (m *Manager) DryRun() bool

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, target string, force bool) error

Install installs an extension by target. Valid targets are: - GitHub: owner/repo - Local: path to executable.

func (*Manager) List

func (m *Manager) List(ctx context.Context, includeLatestVersion bool) ([]Extension, error)

func (*Manager) Remove

func (m *Manager) Remove(ext Extension) error

Remove removes an extension by name(without prefix).

func (*Manager) SetClient

func (m *Manager) SetClient(client *http.Client)

func (*Manager) SetDryRun

func (m *Manager) SetDryRun(v bool)

func (*Manager) Upgrade

func (m *Manager) Upgrade(ctx context.Context, ext Extension) error

Upgrade only GitHub extension can be upgraded

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL