ticket

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ticket turns what a user types into the exact names flow uses on disk. The naming rules here are load-bearing: the branch and worktree use a hyphen between ID and slug, the assets directory uses an underscore, and both must be reproduced identically on every later invocation.

Index

Constants

View Source
const MaxSlugLen = 60

MaxSlugLen bounds the slug so that worktree paths stay manageable.

Variables

This section is empty.

Functions

func IDFromBranch

func IDFromBranch(branch string) (string, bool)

IDFromBranch extracts a ticket ID from a branch name, for branches flow did not create itself.

func LooksLikeID

func LooksLikeID(s string) bool

LooksLikeID reports whether s could be a ticket ID, so that commands taking an optional ticket argument can tell one from a flag value.

func NormalizeID

func NormalizeID(raw string) (string, error)

NormalizeID uppercases and validates a ticket ID: "rd-19471" becomes "RD-19471", and anything that is not PROJECT-NUMBER is rejected.

func Slugify

func Slugify(raw string) (string, error)

Slugify normalizes a free-text description into the slug used in branch, worktree and assets names.

Types

type ErrInvalid

type ErrInvalid struct {
	What  string
	Input string
	Why   string
}

ErrInvalid reports input flow cannot turn into a ticket. Callers map it to exit code 2.

func (*ErrInvalid) Error

func (e *ErrInvalid) Error() string

type Ticket

type Ticket struct {
	ID   string
	Slug string
}

Ticket is a normalized ticket identity.

func New

func New(id, description string) (Ticket, error)

New normalizes an ID and a description into a Ticket.

func ParseDirName

func ParseDirName(name string) (Ticket, bool)

ParseDirName recovers a ticket from a worktree directory name such as "RD-19471-add-new-toolbar".

func (Ticket) Expand

func (t Ticket) Expand(template string) string

Expand substitutes {id} and {slug} in a naming template.

Jump to

Keyboard shortcuts

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