cli

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package cli wires together the spec loader, command builder, auth manager, HTTP executor, and output formatters into a single cobra command tree. It is constructed once at program start.

Index

Constants

View Source
const (
	ExitOK    = 0
	ExitError = 1
	ExitUsage = 2
)

Exit codes per the spec.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Root         *cobra.Command
	Config       *config.Config
	SpecDoc      *openapi3.T
	SpecPath     string
	Auth         auth.Manager
	Executor     *client.Executor
	Out          io.Writer
	ErrOut       io.Writer
	Verbose      bool
	OutputFmt    string
	Compact      bool
	Columns      []string
	BaseURL      string
	Timeout      time.Duration
	Scope        []string
	ClientID     string
	ClientSecret string
	// Keyring used for auth and setup. Mockable for tests.
	Keyring auth.Keyring
	// HTTPClient override used by auth/executor (mainly for tests).
	HTTPClient *http.Client
}

CLI bundles the runtime components and the assembled cobra root command. A single instance is built by New and shared with the command tree via the CLIRunner interface.

func New

func New(args []string) *CLI

New assembles the full CLI. It eagerly resolves the spec from --spec flag, INVGATE_SPEC env, config, or the default location so the dynamic command tree is available before cobra dispatches.

func (*CLI) Execute

func (c *CLI) Execute(args []string) int

Execute runs the cobra root with the given args and returns the exit code.

Jump to

Keyboard shortcuts

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