commands

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package commands defines the CLI command structure for the yapi application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand added in v0.5.0

func BuildCommand(spec CommandSpec) *cobra.Command

BuildCommand creates a cobra command from a spec.

func BuildRoot

func BuildRoot(cfg *Config, handlers *Handlers) *cobra.Command

BuildRoot builds the root command tree with optional handlers. If handlers is nil, commands are built without RunE functions (for doc generation).

Types

type CommandSpec added in v0.5.0

type CommandSpec struct {
	Use     string
	Aliases []string
	Short   string
	Long    string
	Args    cobra.PositionalArgs
	Handler func(*cobra.Command, []string) error
	Flags   []FlagSpec
}

CommandSpec defines the specification for a command.

type Config

type Config struct {
	URLOverride  string
	NoColor      bool
	BinaryOutput bool
	Insecure     bool
	Environment  string // Target environment from project config
}

Config holds configuration for command execution

type FlagSpec added in v0.5.0

type FlagSpec struct {
	Name      string
	Shorthand string
	Type      string // "bool", "string", etc.
	Default   interface{}
	Usage     string
}

FlagSpec defines a command flag.

type Handlers

type Handlers struct {
	RunInteractive func(cmd *cobra.Command, args []string) error
	Run            func(cmd *cobra.Command, args []string) error
	Watch          func(cmd *cobra.Command, args []string) error
	History        func(cmd *cobra.Command, args []string) error
	LSP            func(cmd *cobra.Command, args []string) error
	Version        func(cmd *cobra.Command, args []string) error
	Validate       func(cmd *cobra.Command, args []string) error
	Share          func(cmd *cobra.Command, args []string) error
	Test           func(cmd *cobra.Command, args []string) error
	List           func(cmd *cobra.Command, args []string) error
	Stress         func(cmd *cobra.Command, args []string) error
	About          func(cmd *cobra.Command, args []string) error
	Import         func(cmd *cobra.Command, args []string) error
}

Handlers contains the callback functions for command execution

Jump to

Keyboard shortcuts

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