plugin

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel string
	Context  string
	APIUrl   string
	Format   string
}

Config holds common plugin configuration

type Metadata

type Metadata struct {
	Name        string
	Version     string
	Description string
	Author      string
}

Metadata contains information about a plugin

type SDK

type SDK struct {
	Metadata Metadata
	Config   Config
	RootCmd  *cobra.Command
}

SDK provides common functionality for plugins

func NewSDK

func NewSDK(metadata Metadata) *SDK

NewSDK creates a new plugin SDK instance

func (*SDK) AddCommand

func (s *SDK) AddCommand(cmd *cobra.Command)

AddCommand adds a subcommand to the plugin

func (*SDK) AddLibopsFlags

func (s *SDK) AddLibopsFlags(currentContext string)

AddLibopsFlags adds common libops-specific flags

func (*SDK) ExecInContainer

func (s *SDK) ExecInContainer(ctx context.Context, containerID string, cmd []string) (int, error)

ExecInContainer executes a command in a Docker container This is a convenience wrapper for plugins

func (*SDK) ExecInContainerInteractive

func (s *SDK) ExecInContainerInteractive(ctx context.Context, containerID string, cmd []string) (int, error)

ExecInContainerInteractive executes an interactive command in a Docker container with TTY This is a convenience wrapper for plugins

func (*SDK) Execute

func (s *SDK) Execute()

Execute runs the plugin

func (*SDK) GetContext

func (s *SDK) GetContext() (*config.Context, error)

GetContext loads the sitectl context configuration This is useful for plugins that need to access context-specific settings If no context is specified, returns the current context from config

func (*SDK) GetDockerClient

func (s *SDK) GetDockerClient() (*docker.DockerClient, error)

GetDockerClient creates a Docker client respecting the sitectl context This is a helper for plugins that need to interact with Docker Returns the existing DockerClient which handles both local and remote contexts

func (*SDK) GetMetadataCommand

func (s *SDK) GetMetadataCommand() *cobra.Command

GetMetadataCommand returns a command that displays plugin metadata

Jump to

Keyboard shortcuts

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