extensions

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtTemplateType

type ExtTemplateType int
const (
	GitTemplateType      ExtTemplateType = 0
	GoBinTemplateType    ExtTemplateType = 1
	OtherBinTemplateType ExtTemplateType = 2
)

type Extension

type Extension interface {
	Name() string // Extension Name without gh-
	Path() string // Path to executable
	URL() string
	CurrentVersion() string
	LatestVersion() string
	IsPinned() bool
	UpdateAvailable() bool
	IsBinary() bool
	IsLocal() bool
	Owner() string
}

type ExtensionManager

type ExtensionManager interface {
	List() []Extension
	Install(ghrepo.Interface, string) error
	InstallLocal(dir string) error
	Upgrade(name string, force bool) error
	Remove(name string) error
	Dispatch(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error)
	Create(name string, tmplType ExtTemplateType) error
	EnableDryRunMode()
	UpdateDir(name string) string
}

type ExtensionManagerMock

type ExtensionManagerMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(name string, tmplType ExtTemplateType) error

	// DispatchFunc mocks the Dispatch method.
	DispatchFunc func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)

	// EnableDryRunModeFunc mocks the EnableDryRunMode method.
	EnableDryRunModeFunc func()

	// InstallFunc mocks the Install method.
	InstallFunc func(interfaceMoqParam ghrepo.Interface, s string) error

	// InstallLocalFunc mocks the InstallLocal method.
	InstallLocalFunc func(dir string) error

	// ListFunc mocks the List method.
	ListFunc func() []Extension

	// RemoveFunc mocks the Remove method.
	RemoveFunc func(name string) error

	// UpdateDirFunc mocks the UpdateDir method.
	UpdateDirFunc func(name string) string

	// UpgradeFunc mocks the Upgrade method.
	UpgradeFunc func(name string, force bool) error
	// contains filtered or unexported fields
}

ExtensionManagerMock is a mock implementation of ExtensionManager.

func TestSomethingThatUsesExtensionManager(t *testing.T) {

	// make and configure a mocked ExtensionManager
	mockedExtensionManager := &ExtensionManagerMock{
		CreateFunc: func(name string, tmplType ExtTemplateType) error {
			panic("mock out the Create method")
		},
		DispatchFunc: func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) {
			panic("mock out the Dispatch method")
		},
		EnableDryRunModeFunc: func()  {
			panic("mock out the EnableDryRunMode method")
		},
		InstallFunc: func(interfaceMoqParam ghrepo.Interface, s string) error {
			panic("mock out the Install method")
		},
		InstallLocalFunc: func(dir string) error {
			panic("mock out the InstallLocal method")
		},
		ListFunc: func() []Extension {
			panic("mock out the List method")
		},
		RemoveFunc: func(name string) error {
			panic("mock out the Remove method")
		},
		UpdateDirFunc: func(name string) string {
			panic("mock out the UpdateDir method")
		},
		UpgradeFunc: func(name string, force bool) error {
			panic("mock out the Upgrade method")
		},
	}

	// use mockedExtensionManager in code that requires ExtensionManager
	// and then make assertions.

}

func (*ExtensionManagerMock) Create

func (mock *ExtensionManagerMock) Create(name string, tmplType ExtTemplateType) error

Create calls CreateFunc.

func (*ExtensionManagerMock) CreateCalls

func (mock *ExtensionManagerMock) CreateCalls() []struct {
	Name     string
	TmplType ExtTemplateType
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedExtensionManager.CreateCalls())

func (*ExtensionManagerMock) Dispatch

func (mock *ExtensionManagerMock) Dispatch(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)

Dispatch calls DispatchFunc.

func (*ExtensionManagerMock) DispatchCalls

func (mock *ExtensionManagerMock) DispatchCalls() []struct {
	Args   []string
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

DispatchCalls gets all the calls that were made to Dispatch. Check the length with:

len(mockedExtensionManager.DispatchCalls())

func (*ExtensionManagerMock) EnableDryRunMode

func (mock *ExtensionManagerMock) EnableDryRunMode()

EnableDryRunMode calls EnableDryRunModeFunc.

func (*ExtensionManagerMock) EnableDryRunModeCalls

func (mock *ExtensionManagerMock) EnableDryRunModeCalls() []struct {
}

EnableDryRunModeCalls gets all the calls that were made to EnableDryRunMode. Check the length with:

len(mockedExtensionManager.EnableDryRunModeCalls())

func (*ExtensionManagerMock) Install

func (mock *ExtensionManagerMock) Install(interfaceMoqParam ghrepo.Interface, s string) error

Install calls InstallFunc.

func (*ExtensionManagerMock) InstallCalls

func (mock *ExtensionManagerMock) InstallCalls() []struct {
	InterfaceMoqParam ghrepo.Interface
	S                 string
}

InstallCalls gets all the calls that were made to Install. Check the length with:

len(mockedExtensionManager.InstallCalls())

func (*ExtensionManagerMock) InstallLocal

func (mock *ExtensionManagerMock) InstallLocal(dir string) error

InstallLocal calls InstallLocalFunc.

func (*ExtensionManagerMock) InstallLocalCalls

func (mock *ExtensionManagerMock) InstallLocalCalls() []struct {
	Dir string
}

InstallLocalCalls gets all the calls that were made to InstallLocal. Check the length with:

len(mockedExtensionManager.InstallLocalCalls())

func (*ExtensionManagerMock) List

func (mock *ExtensionManagerMock) List() []Extension

List calls ListFunc.

func (*ExtensionManagerMock) ListCalls

func (mock *ExtensionManagerMock) ListCalls() []struct {
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedExtensionManager.ListCalls())

func (*ExtensionManagerMock) Remove

func (mock *ExtensionManagerMock) Remove(name string) error

Remove calls RemoveFunc.

func (*ExtensionManagerMock) RemoveCalls

func (mock *ExtensionManagerMock) RemoveCalls() []struct {
	Name string
}

RemoveCalls gets all the calls that were made to Remove. Check the length with:

len(mockedExtensionManager.RemoveCalls())

func (*ExtensionManagerMock) UpdateDir

func (mock *ExtensionManagerMock) UpdateDir(name string) string

UpdateDir calls UpdateDirFunc.

func (*ExtensionManagerMock) UpdateDirCalls

func (mock *ExtensionManagerMock) UpdateDirCalls() []struct {
	Name string
}

UpdateDirCalls gets all the calls that were made to UpdateDir. Check the length with:

len(mockedExtensionManager.UpdateDirCalls())

func (*ExtensionManagerMock) Upgrade

func (mock *ExtensionManagerMock) Upgrade(name string, force bool) error

Upgrade calls UpgradeFunc.

func (*ExtensionManagerMock) UpgradeCalls

func (mock *ExtensionManagerMock) UpgradeCalls() []struct {
	Name  string
	Force bool
}

UpgradeCalls gets all the calls that were made to Upgrade. Check the length with:

len(mockedExtensionManager.UpgradeCalls())

type ExtensionMock

type ExtensionMock struct {
	// CurrentVersionFunc mocks the CurrentVersion method.
	CurrentVersionFunc func() string

	// IsBinaryFunc mocks the IsBinary method.
	IsBinaryFunc func() bool

	// IsLocalFunc mocks the IsLocal method.
	IsLocalFunc func() bool

	// IsPinnedFunc mocks the IsPinned method.
	IsPinnedFunc func() bool

	// LatestVersionFunc mocks the LatestVersion method.
	LatestVersionFunc func() string

	// NameFunc mocks the Name method.
	NameFunc func() string

	// OwnerFunc mocks the Owner method.
	OwnerFunc func() string

	// PathFunc mocks the Path method.
	PathFunc func() string

	// URLFunc mocks the URL method.
	URLFunc func() string

	// UpdateAvailableFunc mocks the UpdateAvailable method.
	UpdateAvailableFunc func() bool
	// contains filtered or unexported fields
}

ExtensionMock is a mock implementation of Extension.

func TestSomethingThatUsesExtension(t *testing.T) {

	// make and configure a mocked Extension
	mockedExtension := &ExtensionMock{
		CurrentVersionFunc: func() string {
			panic("mock out the CurrentVersion method")
		},
		IsBinaryFunc: func() bool {
			panic("mock out the IsBinary method")
		},
		IsLocalFunc: func() bool {
			panic("mock out the IsLocal method")
		},
		IsPinnedFunc: func() bool {
			panic("mock out the IsPinned method")
		},
		LatestVersionFunc: func() string {
			panic("mock out the LatestVersion method")
		},
		NameFunc: func() string {
			panic("mock out the Name method")
		},
		OwnerFunc: func() string {
			panic("mock out the Owner method")
		},
		PathFunc: func() string {
			panic("mock out the Path method")
		},
		URLFunc: func() string {
			panic("mock out the URL method")
		},
		UpdateAvailableFunc: func() bool {
			panic("mock out the UpdateAvailable method")
		},
	}

	// use mockedExtension in code that requires Extension
	// and then make assertions.

}

func (*ExtensionMock) CurrentVersion

func (mock *ExtensionMock) CurrentVersion() string

CurrentVersion calls CurrentVersionFunc.

func (*ExtensionMock) CurrentVersionCalls

func (mock *ExtensionMock) CurrentVersionCalls() []struct {
}

CurrentVersionCalls gets all the calls that were made to CurrentVersion. Check the length with:

len(mockedExtension.CurrentVersionCalls())

func (*ExtensionMock) IsBinary

func (mock *ExtensionMock) IsBinary() bool

IsBinary calls IsBinaryFunc.

func (*ExtensionMock) IsBinaryCalls

func (mock *ExtensionMock) IsBinaryCalls() []struct {
}

IsBinaryCalls gets all the calls that were made to IsBinary. Check the length with:

len(mockedExtension.IsBinaryCalls())

func (*ExtensionMock) IsLocal

func (mock *ExtensionMock) IsLocal() bool

IsLocal calls IsLocalFunc.

func (*ExtensionMock) IsLocalCalls

func (mock *ExtensionMock) IsLocalCalls() []struct {
}

IsLocalCalls gets all the calls that were made to IsLocal. Check the length with:

len(mockedExtension.IsLocalCalls())

func (*ExtensionMock) IsPinned

func (mock *ExtensionMock) IsPinned() bool

IsPinned calls IsPinnedFunc.

func (*ExtensionMock) IsPinnedCalls

func (mock *ExtensionMock) IsPinnedCalls() []struct {
}

IsPinnedCalls gets all the calls that were made to IsPinned. Check the length with:

len(mockedExtension.IsPinnedCalls())

func (*ExtensionMock) LatestVersion

func (mock *ExtensionMock) LatestVersion() string

LatestVersion calls LatestVersionFunc.

func (*ExtensionMock) LatestVersionCalls

func (mock *ExtensionMock) LatestVersionCalls() []struct {
}

LatestVersionCalls gets all the calls that were made to LatestVersion. Check the length with:

len(mockedExtension.LatestVersionCalls())

func (*ExtensionMock) Name

func (mock *ExtensionMock) Name() string

Name calls NameFunc.

func (*ExtensionMock) NameCalls

func (mock *ExtensionMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedExtension.NameCalls())

func (*ExtensionMock) Owner

func (mock *ExtensionMock) Owner() string

Owner calls OwnerFunc.

func (*ExtensionMock) OwnerCalls

func (mock *ExtensionMock) OwnerCalls() []struct {
}

OwnerCalls gets all the calls that were made to Owner. Check the length with:

len(mockedExtension.OwnerCalls())

func (*ExtensionMock) Path

func (mock *ExtensionMock) Path() string

Path calls PathFunc.

func (*ExtensionMock) PathCalls

func (mock *ExtensionMock) PathCalls() []struct {
}

PathCalls gets all the calls that were made to Path. Check the length with:

len(mockedExtension.PathCalls())

func (*ExtensionMock) URL

func (mock *ExtensionMock) URL() string

URL calls URLFunc.

func (*ExtensionMock) URLCalls

func (mock *ExtensionMock) URLCalls() []struct {
}

URLCalls gets all the calls that were made to URL. Check the length with:

len(mockedExtension.URLCalls())

func (*ExtensionMock) UpdateAvailable

func (mock *ExtensionMock) UpdateAvailable() bool

UpdateAvailable calls UpdateAvailableFunc.

func (*ExtensionMock) UpdateAvailableCalls

func (mock *ExtensionMock) UpdateAvailableCalls() []struct {
}

UpdateAvailableCalls gets all the calls that were made to UpdateAvailable. Check the length with:

len(mockedExtension.UpdateAvailableCalls())

Jump to

Keyboard shortcuts

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