Documentation
¶
Index ¶
- func SetAtmosConfig(config *schema.AtmosConfiguration)
- type AttachOptions
- type ConfigProvider
- type ContainerInfo
- type DefaultConfigProvider
- func (d *DefaultConfigProvider) GetDevcontainerConfig(config *schema.AtmosConfiguration, name string) (*DevcontainerConfig, error)
- func (d *DefaultConfigProvider) ListDevcontainers(config *schema.AtmosConfiguration) ([]string, error)
- func (d *DefaultConfigProvider) LoadAtmosConfig() (*schema.AtmosConfiguration, error)
- type DefaultUIProvider
- type DevcontainerCommandProvider
- func (d *DevcontainerCommandProvider) GetAliases() []internal.CommandAlias
- func (d *DevcontainerCommandProvider) GetCommand() *cobra.Command
- func (d *DevcontainerCommandProvider) GetCompatibilityFlags() map[string]compat.CompatibilityFlag
- func (d *DevcontainerCommandProvider) GetFlagsBuilder() flags.Builder
- func (d *DevcontainerCommandProvider) GetGroup() string
- func (d *DevcontainerCommandProvider) GetName() string
- func (d *DevcontainerCommandProvider) GetPositionalArgsBuilder() *flags.PositionalArgsBuilder
- type DevcontainerConfig
- type DockerRuntimeProvider
- func (d *DockerRuntimeProvider) Attach(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- func (d *DockerRuntimeProvider) Exec(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- func (d *DockerRuntimeProvider) ListRunning(ctx context.Context) ([]ContainerInfo, error)
- func (d *DockerRuntimeProvider) Logs(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) (io.ReadCloser, error)
- func (d *DockerRuntimeProvider) Rebuild(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- func (d *DockerRuntimeProvider) Remove(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- func (d *DockerRuntimeProvider) Start(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- func (d *DockerRuntimeProvider) Stop(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, ...) error
- type ExecOptions
- type LogsOptions
- type RebuildOptions
- type RemoveOptions
- type RuntimeProvider
- type Service
- func (s *Service) Attach(ctx context.Context, name string, opts AttachOptions) error
- func (s *Service) Exec(ctx context.Context, name string, cmd []string, opts ExecOptions) error
- func (s *Service) Initialize() error
- func (s *Service) InitializeWithConfig(config *schema.AtmosConfiguration)
- func (s *Service) List(ctx context.Context) ([]ContainerInfo, error)
- func (s *Service) Logs(ctx context.Context, name string, opts LogsOptions) error
- func (s *Service) Rebuild(ctx context.Context, name string, opts RebuildOptions) error
- func (s *Service) Remove(ctx context.Context, name string, opts RemoveOptions) error
- func (s *Service) ResolveDevcontainerName(ctx context.Context, args []string) (string, error)
- func (s *Service) SetLogOutput(w io.Writer)
- func (s *Service) Start(ctx context.Context, name string, opts StartOptions) error
- func (s *Service) Stop(ctx context.Context, name string, opts StopOptions) error
- type ShellOptions
- type StartOptions
- type StopOptions
- type UIProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAtmosConfig ¶
func SetAtmosConfig(config *schema.AtmosConfiguration)
SetAtmosConfig sets the Atmos configuration for the devcontainer command. SetAtmosConfig sets the package-level pointer to the provided AtmosConfiguration so devcontainer commands and providers can access the initialized configuration. It is intended to be called once during application initialization (for example, from root.go) after the Atmos configuration has been created.
Types ¶
type AttachOptions ¶
AttachOptions contains parsed flags for the attach command.
type ConfigProvider ¶
type ConfigProvider interface {
// LoadAtmosConfig loads the Atmos configuration.
LoadAtmosConfig() (*schema.AtmosConfiguration, error)
// ListDevcontainers returns all configured devcontainer names, sorted.
ListDevcontainers(config *schema.AtmosConfiguration) ([]string, error)
// GetDevcontainerConfig retrieves configuration for a specific devcontainer.
GetDevcontainerConfig(config *schema.AtmosConfiguration, name string) (*DevcontainerConfig, error)
}
ConfigProvider handles configuration loading and parsing.
type ContainerInfo ¶
ContainerInfo contains information about a running container.
type DefaultConfigProvider ¶
type DefaultConfigProvider struct{}
DefaultConfigProvider uses pkg/config for configuration.
func (*DefaultConfigProvider) GetDevcontainerConfig ¶
func (d *DefaultConfigProvider) GetDevcontainerConfig( config *schema.AtmosConfiguration, name string, ) (*DevcontainerConfig, error)
GetDevcontainerConfig retrieves configuration for a specific devcontainer.
func (*DefaultConfigProvider) ListDevcontainers ¶
func (d *DefaultConfigProvider) ListDevcontainers(config *schema.AtmosConfiguration) ([]string, error)
ListDevcontainers returns all configured devcontainer names, sorted.
func (*DefaultConfigProvider) LoadAtmosConfig ¶
func (d *DefaultConfigProvider) LoadAtmosConfig() (*schema.AtmosConfiguration, error)
LoadAtmosConfig loads the Atmos configuration.
type DefaultUIProvider ¶
type DefaultUIProvider struct{}
DefaultUIProvider uses terminal for UI operations.
func (*DefaultUIProvider) Confirm ¶
func (d *DefaultUIProvider) Confirm(message string) (bool, error)
Confirm asks a yes/no question.
func (*DefaultUIProvider) Error ¶
func (d *DefaultUIProvider) Error() io.Writer
Error returns the writer for error output.
func (*DefaultUIProvider) IsInteractive ¶
func (d *DefaultUIProvider) IsInteractive() bool
IsInteractive returns true if running in an interactive terminal.
func (*DefaultUIProvider) Output ¶
func (d *DefaultUIProvider) Output() io.Writer
Output returns the writer for normal output (typically stderr for UI).
type DevcontainerCommandProvider ¶
type DevcontainerCommandProvider struct{}
DevcontainerCommandProvider implements the CommandProvider interface.
func (*DevcontainerCommandProvider) GetAliases ¶
func (d *DevcontainerCommandProvider) GetAliases() []internal.CommandAlias
GetAliases returns command aliases (none for devcontainer).
func (*DevcontainerCommandProvider) GetCommand ¶
func (d *DevcontainerCommandProvider) GetCommand() *cobra.Command
GetCommand returns the devcontainer command.
func (*DevcontainerCommandProvider) GetCompatibilityFlags ¶
func (d *DevcontainerCommandProvider) GetCompatibilityFlags() map[string]compat.CompatibilityFlag
GetCompatibilityFlags returns compatibility flags for this command.
func (*DevcontainerCommandProvider) GetFlagsBuilder ¶
func (d *DevcontainerCommandProvider) GetFlagsBuilder() flags.Builder
GetFlagsBuilder returns the flags builder for this command.
func (*DevcontainerCommandProvider) GetGroup ¶
func (d *DevcontainerCommandProvider) GetGroup() string
GetGroup returns the command group for help organization.
func (*DevcontainerCommandProvider) GetName ¶
func (d *DevcontainerCommandProvider) GetName() string
GetName returns the command name.
func (*DevcontainerCommandProvider) GetPositionalArgsBuilder ¶
func (d *DevcontainerCommandProvider) GetPositionalArgsBuilder() *flags.PositionalArgsBuilder
GetPositionalArgsBuilder returns the positional args builder for this command.
type DevcontainerConfig ¶
type DevcontainerConfig struct {
Name string
Image string
BuildArgs map[string]string
Mounts []string
}
DevcontainerConfig represents parsed devcontainer configuration.
type DockerRuntimeProvider ¶
type DockerRuntimeProvider struct {
// contains filtered or unexported fields
}
DockerRuntimeProvider uses pkg/devcontainer for runtime operations.
func NewDockerRuntimeProvider ¶
func NewDockerRuntimeProvider() *DockerRuntimeProvider
NewDockerRuntimeProvider creates a new Docker runtime provider.
func (*DockerRuntimeProvider) Attach ¶
func (d *DockerRuntimeProvider) Attach(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts AttachOptions) error
Attach attaches to a running devcontainer.
func (*DockerRuntimeProvider) Exec ¶
func (d *DockerRuntimeProvider) Exec(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, cmd []string, opts ExecOptions) error
Exec executes a command in a running devcontainer.
func (*DockerRuntimeProvider) ListRunning ¶
func (d *DockerRuntimeProvider) ListRunning(ctx context.Context) ([]ContainerInfo, error)
ListRunning returns all running devcontainer instances.
func (*DockerRuntimeProvider) Logs ¶
func (d *DockerRuntimeProvider) Logs(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts LogsOptions) (io.ReadCloser, error)
Logs retrieves logs from a devcontainer.
func (*DockerRuntimeProvider) Rebuild ¶
func (d *DockerRuntimeProvider) Rebuild(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts RebuildOptions) error
Rebuild rebuilds a devcontainer.
func (*DockerRuntimeProvider) Remove ¶
func (d *DockerRuntimeProvider) Remove(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts RemoveOptions) error
Remove removes a devcontainer.
func (*DockerRuntimeProvider) Start ¶
func (d *DockerRuntimeProvider) Start(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts StartOptions) error
Start starts a devcontainer.
func (*DockerRuntimeProvider) Stop ¶
func (d *DockerRuntimeProvider) Stop(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts StopOptions) error
Stop stops a running devcontainer.
type ExecOptions ¶
ExecOptions contains parsed flags for the exec command.
type LogsOptions ¶
LogsOptions contains parsed flags for the logs command.
type RebuildOptions ¶
RebuildOptions contains parsed flags for the rebuild command.
type RemoveOptions ¶
RemoveOptions contains parsed flags for the remove command.
type RuntimeProvider ¶
type RuntimeProvider interface {
// ListRunning returns all running devcontainer instances.
ListRunning(ctx context.Context) ([]ContainerInfo, error)
// Start starts a devcontainer.
Start(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts StartOptions) error
// Stop stops a running devcontainer.
Stop(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts StopOptions) error
// Attach attaches to a running devcontainer.
Attach(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts AttachOptions) error
// Exec executes a command in a running devcontainer.
Exec(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, cmd []string, opts ExecOptions) error
// Logs retrieves logs from a devcontainer.
Logs(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts LogsOptions) (io.ReadCloser, error)
// Remove removes a devcontainer.
Remove(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts RemoveOptions) error
// Rebuild rebuilds a devcontainer.
Rebuild(ctx context.Context, atmosConfig *schema.AtmosConfiguration, name string, opts RebuildOptions) error
}
RuntimeProvider abstracts container runtime operations.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates devcontainer operations.
func NewTestableService ¶
func NewTestableService( config ConfigProvider, runtime RuntimeProvider, ui UIProvider, ) *Service
NewTestableService creates a Service configured with the provided config, runtime, and UI providers for use in tests.
func NewTestableServiceWithLogOutput ¶
func NewTestableServiceWithLogOutput( config ConfigProvider, runtime RuntimeProvider, ui UIProvider, logOutput io.Writer, ) *Service
NewTestableServiceWithLogOutput creates a Service for tests with a custom log output writer.
func (*Service) Initialize ¶
Initialize loads the Atmos configuration. Call this once during startup.
func (*Service) InitializeWithConfig ¶
func (s *Service) InitializeWithConfig(config *schema.AtmosConfiguration)
InitializeWithConfig sets the Atmos configuration directly. Use this in tests or when config is already available.
func (*Service) List ¶
func (s *Service) List(ctx context.Context) ([]ContainerInfo, error)
List lists all running devcontainers.
func (*Service) Logs ¶
Logs retrieves logs from a devcontainer and streams them to the configured output.
func (*Service) ResolveDevcontainerName ¶
ResolveDevcontainerName gets devcontainer name from args or prompts user. This is a common operation used by multiple commands.
func (*Service) SetLogOutput ¶
SetLogOutput sets the writer for log output. This allows tests and alternative frontends to capture or redirect log output.
type ShellOptions ¶
type ShellOptions struct {
Instance string
Identity string
UsePTY bool
New bool
Replace bool
Rm bool
NoPull bool
}
ShellOptions contains parsed flags for the shell command.
type StartOptions ¶
StartOptions contains parsed flags for the start command.
type StopOptions ¶
StopOptions contains parsed flags for the stop command.
type UIProvider ¶
type UIProvider interface {
// IsInteractive returns true if running in an interactive terminal.
IsInteractive() bool
// Prompt displays a menu and returns the selected item.
Prompt(message string, options []string) (string, error)
// Confirm asks a yes/no question.
Confirm(message string) (bool, error)
// Output returns the writer for normal output (typically stderr for UI).
Output() io.Writer
// Error returns the writer for error output.
Error() io.Writer
}
UIProvider handles user interaction.