relcmd

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package relcmd provides the "rel" parent command, which groups relationship management operations under a single namespace. Subcommands are organized by relationship type (blocks, cites, parent) and include utilities for listing, tree views, and cycle detection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRelationships

func FilterRelationships(rels []driving.RelationshipDTO, types ...string) []driving.RelationshipDTO

FilterRelationships returns only the relationships whose type string matches any of the given type strings. This is the shared filtering logic used by blocks list and cites list.

func NewCmd

func NewCmd(f *cmdutil.Factory) *cli.Command

NewCmd constructs the "rel" parent command with subcommands for managing issue relationships by type.

func RunAdd

func RunAdd(ctx context.Context, input RunAddInput) error

RunAdd executes the rel add workflow. It parses the relationship argument, dispatches to the appropriate service method, and writes output.

func RunDetach

func RunDetach(ctx context.Context, input RunDetachInput) error

RunDetach removes the parent-child relationship between A and B. The order of A and B does not matter — the command inspects both issues to determine which is the child. Uses one-shot update (atomic claim→update→release) so no explicit claim is needed.

func RunUnblock

func RunUnblock(ctx context.Context, input RunUnblockInput) error

RunUnblock removes any blocking relationship between A and B regardless of direction. Delegates to the service's RemoveBidirectionalBlock method which tries both "A blocked_by B" and "B blocked_by A" directions.

Types

type RelArgResult

type RelArgResult struct {
	// Type classifies the dispatch path.
	Type RelArgType
	// Label is the canonical string form of the relationship (e.g. "blocked_by").
	Label string
	// RelType is the domain relationship type, populated only when Type is
	// RelArgRelationship.
	RelType domain.RelationType
}

RelArgResult holds the parsed result of a relationship argument string.

func ParseRelArg

func ParseRelArg(s string) (RelArgResult, error)

ParseRelArg parses a relationship argument string into a dispatch decision. Returns an error if the argument is not one of the six accepted values.

type RelArgType

type RelArgType int

RelArgType classifies how a relationship argument should be dispatched.

const (
	// RelArgRelationship means the argument maps to a standard
	// AddRelationship call (blocks, blocked_by, cites, cited_by, refs).
	RelArgRelationship RelArgType = iota + 1

	// RelArgParentOf means A is the parent of B — sets B's parent to A.
	RelArgParentOf

	// RelArgChildOf means A is a child of B — sets A's parent to B.
	RelArgChildOf
)

type RunAddInput

type RunAddInput struct {
	Service driving.Service
	A       string
	Rel     string
	B       string
	ClaimID string
	Author  string
	JSON    bool
	WriteTo io.Writer
}

RunAddInput holds the parameters for the add command's core logic, decoupled from CLI flag parsing so it can be tested directly.

type RunDetachInput

type RunDetachInput struct {
	Service driving.Service
	A       string
	B       string
	Author  string
	JSON    bool
	WriteTo io.Writer
}

RunDetachInput holds the parameters for the detach command's core logic, decoupled from CLI flag parsing so it can be tested directly.

type RunUnblockInput

type RunUnblockInput struct {
	Service driving.Service
	A       string
	B       string
	Author  string
	JSON    bool
	WriteTo io.Writer
}

RunUnblockInput holds the parameters for the unblock command's core logic, decoupled from CLI flag parsing so it can be tested directly.

Directories

Path Synopsis
Package graphcmd implements the "graph" CLI command, which renders the issue hierarchy and relationships as a Graphviz DOT file.
Package graphcmd implements the "graph" CLI command, which renders the issue hierarchy and relationships as a Graphviz DOT file.

Jump to

Keyboard shortcuts

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