delete

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: 8 Imported by: 0

Documentation

Overview

Package delete provides functionality for deleting branches and their metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// Start is called at the beginning of delete
	Start(branchCount int)

	// OnBranch is called for each branch being deleted
	OnBranch(name string, status Status, prNumber *int)

	// OnRestack is called when restacking children
	OnRestack(childCount int)

	// Complete is called when delete finishes
	Complete(deleted, skipped int)

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

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

	// PromptConfirm prompts user for confirmation before deleting
	PromptConfirm(branch string, reason string) (bool, error)
}

Handler receives events from delete 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) Complete

func (h *NullHandler) Complete(int, int)

Complete implements Handler.

func (*NullHandler) OnBranch

func (h *NullHandler) OnBranch(string, Status, *int)

OnBranch implements Handler.

func (*NullHandler) OnRestack

func (h *NullHandler) OnRestack(int)

OnRestack implements Handler.

func (*NullHandler) PromptConfirm

func (h *NullHandler) PromptConfirm(string, string) (bool, error)

PromptConfirm implements Handler.

func (*NullHandler) Start

func (h *NullHandler) Start(int)

Start implements Handler.

type Options

type Options struct {
	BranchName string
	Downstack  bool
	Force      bool
	Upstack    bool
}

Options contains options for deleting branches

type Result

type Result struct {
	MainRepoDirForSwitch string
}

Result contains the result of the delete action.

func Action

func Action(ctx *app.Context, opts Options, handler Handler) (Result, error)

Action deletes a branch and its metadata.

type Status

type Status string

Status represents the status of a branch deletion

const (
	StatusDeleted   Status = "deleted"
	StatusSkipped   Status = "skipped"
	StatusRestacked Status = "restacked"
)

Delete status constants

Jump to

Keyboard shortcuts

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