navigation

package
v0.17.15 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package navigation implements the stackit top/bottom commands for navigating stacked branches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SwitchBranchAction

func SwitchBranchAction(direction Direction, ctx *app.Context, handler Handler) (actions.CheckoutResult, error)

SwitchBranchAction switches to a branch based on the given direction

Types

type Direction

type Direction string

Direction represents the traversal direction

const (
	// DirectionBottom specifies navigating towards the trunk
	DirectionBottom Direction = "BOTTOM"
	// DirectionTop specifies navigating towards the stack tips
	DirectionTop Direction = "TOP"
)

type Handler

type Handler interface {
	// PromptSelectBranch prompts user to select a branch when multiple children exist
	// Returns the selected branch name
	PromptSelectBranch(message string, branches []string) (string, error)

	// Cleanup restores terminal state (may be no-op)
	Cleanup()

	// IsInteractive returns true if the handler supports interactive prompts
	IsInteractive() bool
}

Handler receives events from navigation action

type NullHandler

type NullHandler struct {
	handler.NullBase
}

NullHandler is a no-op handler for when nil is passed. It embeds handler.NullBase for Cleanup() and IsInteractive().

func (*NullHandler) PromptSelectBranch

func (h *NullHandler) PromptSelectBranch(string, []string) (string, error)

PromptSelectBranch implements Handler. Returns empty string for null handler.

Jump to

Keyboard shortcuts

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