kongcmd

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(target any, name, description string, stdout, stderr io.Writer) (*kong.Kong, error)

New builds a Kong parser with the standard Braidplane command metadata, writers, and exit handling used by command entrypoints.

func RecoverExit

func RecoverExit(err *error, exitError func(code int) error)

RecoverExit converts Kong's configured exit panic into the caller's error contract while preserving unrelated panics.

Types

type ParseResult

type ParseResult[T any] struct {
	CLI      T
	Context  *kong.Context
	ExitCode int
	Exited   bool
}

ParseResult captures a parsed Kong target plus any Kong-managed exit.

func Parse

func Parse[T any](
	args []string,
	cli T,
	name string,
	description string,
	stdout io.Writer,
	stderr io.Writer,
	exitError func(code int) error,
) (result ParseResult[T], err error)

Parse builds the standard parser, parses args into cli, and reports help or other Kong-managed exits without terminating the process.

Jump to

Keyboard shortcuts

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