Help us shape the future of Go! Take the 2026 Go Developer Survey

navigation

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 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 FlattenThroughAnchors added in v0.27.0

func FlattenThroughAnchors(branches engine.Branches, graph *engine.StackGraph) engine.Branches

FlattenThroughAnchors replaces worktree anchor branches with their non-anchor children.

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