urfavecli

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package urfavecli implements a frictionax.CLIAdapter for the urfave/cli/v2 framework.

It provides command/flag enumeration and structured error parsing, enabling the frictionax suggestion engine to offer corrections for CLI usage errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UrfaveAdapter

type UrfaveAdapter struct {
	// contains filtered or unexported fields
}

UrfaveAdapter implements frictionax.CLIAdapter for urfave/cli/v2 apps.

func NewUrfaveAdapter

func NewUrfaveAdapter(app *cli.App) *UrfaveAdapter

NewUrfaveAdapter creates a new adapter for the given urfave/cli App.

func (*UrfaveAdapter) CommandNames

func (a *UrfaveAdapter) CommandNames() []string

CommandNames returns all available command names. Returns names as "subcmd" or "parent subcmd" for nested commands. Hidden commands are excluded.

func (*UrfaveAdapter) FlagNames

func (a *UrfaveAdapter) FlagNames(command string) []string

FlagNames returns all available flag names for a command. If command is empty, returns global flags from the app. Returns flags as "--name" and "-shorthand" where applicable.

func (*UrfaveAdapter) ParseError

func (a *UrfaveAdapter) ParseError(err error) *frictionax.ParsedError

ParseError extracts structured info from a urfave/cli error. Returns nil if the error is not a parseable urfave/cli error.

Recognized patterns:

  • "flag provided but not defined: -X" / "flag provided but not defined: --X"
  • "command \"X\" not found" / various unknown command patterns
  • "Required flag \"X\" not set" / "Required flags \"X\", \"Y\" not set"
  • "invalid value \"X\" for flag -Y"

Jump to

Keyboard shortcuts

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