surface

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnapshotString

func SnapshotString(cmd *cobra.Command) string

SnapshotString returns a sorted, newline-joined string of all surface entries.

Types

type DiffResult

type DiffResult struct {
	Added   []Entry // Entries in new but not in old
	Removed []Entry // Entries in old but not in new (breaking changes)
}

DiffResult contains the differences between two surface snapshots.

func Diff

func Diff(old, new []Entry) DiffResult

Diff compares two snapshots and returns additions and removals.

func (DiffResult) HasBreakingChanges

func (d DiffResult) HasBreakingChanges() bool

HasBreakingChanges returns true if any entries were removed.

type Entry

type Entry struct {
	Kind     EntryKind
	Path     string // Full command path (e.g., "basecamp projects list")
	Name     string // Flag or subcommand name
	FlagType string // Flag type (e.g., "string", "bool") — only for FLAG entries
}

Entry represents a single element in the CLI surface.

func Snapshot

func Snapshot(cmd *cobra.Command) []Entry

Snapshot walks a Cobra command tree and returns all surface entries.

func (Entry) String

func (e Entry) String() string

String returns the canonical string representation of the entry. Format: "CMD path", "FLAG path --name type=flagtype", "SUB path name"

type EntryKind

type EntryKind string

EntryKind identifies the type of surface entry.

const (
	KindCmd  EntryKind = "CMD"
	KindFlag EntryKind = "FLAG"
	KindSub  EntryKind = "SUB"
)

Jump to

Keyboard shortcuts

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