Documentation
¶
Overview ¶
Package extensions provides the gpd extension system for installable subcommands.
Package extensions provides the gpd extension system for installable subcommands.
Package extensions provides the gpd extension system for installable subcommands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExecutablePath ¶
GetExecutablePath returns the full path to an extension's executable.
func GetExtensionsDir ¶
func GetExtensionsDir() string
GetExtensionsDir returns the directory where extensions are installed.
func IsBuiltInCommand ¶
IsBuiltInCommand checks if a command name is reserved for built-in commands.
func IsInstalled ¶
IsInstalled checks if an extension is installed.
Types ¶
type Extension ¶
type Extension struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Author string `json:"author,omitempty" yaml:"author,omitempty"`
Bin string `json:"bin,omitempty" yaml:"bin,omitempty"`
Source string `json:"source" yaml:"source"` // GitHub repo path (owner/repo)
InstalledAt time.Time `json:"installedAt" yaml:"installedAt"`
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
Pinned bool `json:"pinned" yaml:"pinned"` // Whether auto-upgrade is disabled
PinnedRef string `json:"pinnedRef,omitempty" yaml:"pinnedRef,omitempty"` // Tag or commit if pinned
Type string `json:"type" yaml:"type"` // "binary" or "script"
}
Extension represents an installed gpd extension.
func LoadExtension ¶
LoadExtension loads an extension by name from the extensions directory.
type InstallOptions ¶
type InstallOptions struct {
Source string // GitHub repo (owner/repo) or local path
Pin bool // Pin to specific ref
PinnedRef string // Tag or commit to pin to
Force bool // Overwrite existing
Timeout time.Duration // HTTP timeout
}
InstallOptions contains options for installing an extension.
type InstallResult ¶
type InstallResult struct {
Extension *Extension
Installed bool // Whether this was a new install or update
}
InstallResult contains information about the installed extension.
func Install ¶
func Install(ctx context.Context, opts InstallOptions) (*InstallResult, error)
Install installs an extension from a GitHub repository or local path.
type Manifest ¶
type Manifest struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Author string `json:"author,omitempty" yaml:"author,omitempty"`
Bin string `json:"bin,omitempty" yaml:"bin,omitempty"` // Executable name (defaults to gpd-<name>)
Homepage string `json:"homepage,omitempty" yaml:"homepage,omitempty"`
}
Manifest represents the .gpd-extension file in an extension repository.
func (*Manifest) DefaultBinName ¶
DefaultBinName returns the default executable name for an extension.