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

format

package
v0.43.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package format provides shared formatting utilities for CLI output and registry allocation field extraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayName

func DisplayName(a Allocation) string

DisplayName returns the best human-readable label for an allocation. Prefers branch (if set), falls back to worktree_name.

func DropDatabases

func DropDatabases(allocs []Allocation)

DropDatabases drops databases for the given allocations using the appropriate adapter. Prints warnings to stderr for any failures but continues processing remaining databases.

func DropSingleDB

func DropSingleDB(alloc Allocation, worktreePath string)

DropSingleDB drops the database for a single allocation.

func GetPorts

func GetPorts(a Allocation) []int

GetPorts extracts the port list from an allocation. Returns nil if no ports found. Handles both the "ports" array format and legacy single "port" field.

func GetStr

func GetStr(a Allocation, key string) string

GetStr extracts a string field from an allocation. Returns empty string if not found.

func JoinInts

func JoinInts(ints []int, sep string) string

JoinInts formats a slice of integers as a string with the given separator.

func PortDisplay

func PortDisplay(a Allocation) string

PortDisplay returns a formatted port string like ":3000" or empty if no ports.

Types

type Allocation

type Allocation map[string]any

Allocation is a map representing a registry entry. Defined here to avoid import cycles between format and registry packages.

Jump to

Keyboard shortcuts

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