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 ¶
- func FilterRelationships(rels []driving.RelationshipDTO, types ...string) []driving.RelationshipDTO
- func NewCmd(f *cmdutil.Factory) *cli.Command
- func RunAdd(ctx context.Context, input RunAddInput) error
- func RunDetach(ctx context.Context, input RunDetachInput) error
- func RunUnblock(ctx context.Context, input RunUnblockInput) error
- type RelArgResult
- type RelArgType
- type RunAddInput
- type RunDetachInput
- type RunUnblockInput
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 ¶
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.