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

lock

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 lock provides functionality for locking and unlocking branches in a stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx *app.Context, branchName string, handler Handler) error

Action locks the specified branch and all branches downstack of it

func Unlock

func Unlock(ctx *app.Context, branchName string, handler Handler) error

Unlock unlocks the specified branch and all branches upstack of it

Types

type Handler

type Handler interface {
	// PromptSubmitBeforeLock prompts user to submit unpushed changes before locking
	// Returns true to submit before locking, false to skip
	PromptSubmitBeforeLock(unpushedBranches []string) (bool, error)

	// PromptUnlockDownstack prompts user to also unlock downstack locked branches
	// Returns true to unlock downstack branches, false to skip
	PromptUnlockDownstack(lockedBranchNames []string) (bool, error)

	// GetSubmitHandler returns a handler for the nested submit operation
	GetSubmitHandler() submit.Handler

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

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

Handler receives events from lock/unlock actions

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) GetSubmitHandler

func (h *NullHandler) GetSubmitHandler() submit.Handler

GetSubmitHandler implements Handler. Returns nil for null handler.

func (*NullHandler) PromptSubmitBeforeLock

func (h *NullHandler) PromptSubmitBeforeLock([]string) (bool, error)

PromptSubmitBeforeLock implements Handler. Returns false (skip submit) for null handler.

func (*NullHandler) PromptUnlockDownstack

func (h *NullHandler) PromptUnlockDownstack([]string) (bool, error)

PromptUnlockDownstack implements Handler. Returns false (skip) for null handler.

Jump to

Keyboard shortcuts

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