Documentation
¶
Overview ¶
Package ide provides IDE opening functionality through hooks.
Package ide provides IDE opening functionality through hooks.
Index ¶
- Constants
- Variables
- type Cursor
- type Dummy
- type IDE
- type Manager
- type ManagerInterface
- type NewManagerParams
- type OpeningHook
- func (h *OpeningHook) Execute(_ *hooks.HookContext) error
- func (h *OpeningHook) Name() string
- func (h *OpeningHook) OnError(_ *hooks.HookContext) error
- func (h *OpeningHook) PostExecute(ctx *hooks.HookContext) error
- func (h *OpeningHook) PreExecute(_ *hooks.HookContext) error
- func (h *OpeningHook) Priority() int
- func (h *OpeningHook) RegisterForOperations(registerHook func(operation string, hook hooks.PostHook) error) error
- type VSCode
- type VSCodium
Constants ¶
const ( // CursorName is the name identifier for the Cursor IDE. CursorName = "cursor" // CursorCommand is the command to open Cursor. CursorCommand = "cursor" )
const ( // VSCodeName is the name identifier for the VS Code IDE. VSCodeName = "vscode" // VSCodeCommand is the command to open VS Code. VSCodeCommand = "code" )
const ( // VSCodiumName is the name identifier for the VSCodium IDE. VSCodiumName = "vscodium" // VSCodiumCommand is the command to open VSCodium. VSCodiumCommand = "codium" )
const DefaultIDE = VSCodeName
DefaultIDE is the default IDE name used when no IDE is specified.
const (
// DummyName is the name identifier for the Dummy IDE.
DummyName = "dummy"
)
Variables ¶
var ( // ErrIDENotInstalled is returned when an IDE is not installed on the system. ErrIDENotInstalled = errors.New("IDE not installed") // ErrUnsupportedIDE is returned when an IDE is not supported. ErrUnsupportedIDE = errors.New("unsupported IDE") // ErrIDEExecutionFailed is returned when IDE command execution fails. ErrIDEExecutionFailed = errors.New("failed to execute IDE command") // ErrWorktreeNotFound is returned when a worktree is not found in status.yaml. ErrWorktreeNotFound = errors.New("worktree not found") // ErrWorktreePathRequired is returned when the worktreePath parameter is missing. ErrWorktreePathRequired = errors.New("cannot open IDE: worktreePath parameter is required") // ErrWorktreePathEmpty is returned when the worktreePath parameter is empty. ErrWorktreePathEmpty = errors.New("cannot open IDE: worktreePath must be a non-empty string") )
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents the Cursor IDE implementation.
func (*Cursor) IsInstalled ¶
IsInstalled checks if Cursor is installed on the system.
func (*Cursor) OpenRepository ¶
OpenRepository opens Cursor with the specified repository path.
type Dummy ¶
type Dummy struct {
// contains filtered or unexported fields
}
Dummy represents a dummy IDE implementation for testing.
func (*Dummy) IsInstalled ¶
IsInstalled always returns true for the dummy IDE.
func (*Dummy) OpenRepository ¶
OpenRepository does nothing but returns success.
type IDE ¶
type IDE interface { // Name returns the name of the IDE Name() string // IsInstalled checks if the IDE is installed on the system IsInstalled() bool // OpenRepository opens the IDE with the specified repository path OpenRepository(path string) error }
IDE interface defines the methods that all IDE implementations must provide.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages IDE implementations and provides a unified interface.
func NewManager ¶
func NewManager(params NewManagerParams) *Manager
NewManager creates a new IDE manager with registered IDE implementations.
type ManagerInterface ¶
type ManagerInterface interface { // GetIDE returns the IDE implementation for the given name GetIDE(name string) (IDE, error) // OpenIDE opens the specified IDE with the given path OpenIDE(name, path string) error }
ManagerInterface defines the interface for IDE management.
type NewManagerParams ¶ added in v0.26.0
NewManagerParams contains the parameters for creating a new IDE manager.
type OpeningHook ¶
type OpeningHook struct {
IDEManager ManagerInterface
}
OpeningHook provides IDE opening functionality as a post-hook.
func NewOpeningHook ¶
func NewOpeningHook() *OpeningHook
NewOpeningHook creates a new OpeningHook instance and registers it for appropriate operations.
func (*OpeningHook) Execute ¶
func (h *OpeningHook) Execute(_ *hooks.HookContext) error
Execute is a no-op for OpeningHook as it implements specific methods.
func (*OpeningHook) OnError ¶
func (h *OpeningHook) OnError(_ *hooks.HookContext) error
OnError is a no-op for OpeningHook.
func (*OpeningHook) PostExecute ¶
func (h *OpeningHook) PostExecute(ctx *hooks.HookContext) error
PostExecute validates IDE opening parameters and opens the IDE after successful operations.
func (*OpeningHook) PreExecute ¶
func (h *OpeningHook) PreExecute(_ *hooks.HookContext) error
PreExecute is a no-op for OpeningHook.
func (*OpeningHook) Priority ¶
func (h *OpeningHook) Priority() int
Priority returns the hook priority (lower numbers execute first).
func (*OpeningHook) RegisterForOperations ¶
func (h *OpeningHook) RegisterForOperations(registerHook func(operation string, hook hooks.PostHook) error) error
RegisterForOperations registers this hook for the operations that create worktrees.
type VSCode ¶
type VSCode struct {
// contains filtered or unexported fields
}
VSCode represents the VS Code IDE implementation.
func (*VSCode) IsInstalled ¶
IsInstalled checks if VS Code is installed on the system.
func (*VSCode) OpenRepository ¶
OpenRepository opens VS Code with the specified repository path.
type VSCodium ¶ added in v0.27.1
type VSCodium struct {
// contains filtered or unexported fields
}
VSCodium represents the VSCodium IDE implementation.
func NewVSCodium ¶ added in v0.27.1
NewVSCodium creates a new VSCodium IDE instance.
func (*VSCodium) IsInstalled ¶ added in v0.27.1
IsInstalled checks if VSCodium is installed on the system.
func (*VSCodium) OpenRepository ¶ added in v0.27.1
OpenRepository opens VSCodium with the specified repository path.