parser

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SepSpaces = "spaces"
	SepDash   = "dash"
	SepColon  = "colon"
)

Separator type constants.

Variables

This section is empty.

Functions

func Parse

func Parse(name, helpText string) *model.Node

Parse parses a --help output string and returns a Node.

Types

type Block

type Block struct {
	Kind      BlockKind
	Header    string   // header text (for BlockHeader blocks)
	Section   string   // categorized: "commands", "options", "other", ""
	Lines     []string // raw lines in this block
	KeyCol    int      // start column of the key column (-1 if not a table)
	DescCol   int      // start column of the description column (-1 if not a table)
	Separator string   // detected separator: SepSpaces, SepDash, SepColon
}

Block represents a contiguous group of lines sharing the same structure.

type BlockKind

type BlockKind int

BlockKind classifies a structural block in help output.

const (
	BlockUnknown BlockKind = iota
	BlockHeader            // section header line (e.g., "Commands:", "  FLAGS")
	BlockTable             // two-column table (key + description)
	BlockSingle            // single-column indented list (bare names, comma lists)
	BlockProse             // free-form text (description paragraphs)
)

Jump to

Keyboard shortcuts

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