command

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCompletions added in v0.0.34

func DefaultCompletions(cmdCtx wargcore.Context) (*completion.Candidates, error)

func DoNothing

func DoNothing(_ wargcore.Context) error

DoNothing is a command action that simply returns an error. Useful for prototyping

func New

func New(helpShort string, action wargcore.Action, opts ...CommandOpt) wargcore.Command

New builds a Command

Types

type CommandOpt

type CommandOpt func(*wargcore.Command)

A CommandOpt customizes a Command

func Completions added in v0.0.34

func Completions(CompletionsFunc wargcore.CompletionsFunc) CommandOpt

func Flag

func Flag(name string, value wargcore.Flag) CommandOpt

Flag adds an existing flag to a Command. It panics if a flag with the same name exists

func FlagMap added in v0.0.28

func FlagMap(flagMap wargcore.FlagMap) CommandOpt

FlagMap adds existing flags to a Command. It panics if a flag with the same name exists

func Footer(footer string) CommandOpt

Footer adds an Help string to the command - useful from a help function

func HelpLong

func HelpLong(helpLong string) CommandOpt

HelpLong adds an Help string to the command - useful from a help function

func NewFlag added in v0.0.28

func NewFlag(name string, helpShort string, empty value.EmptyConstructor, opts ...flag.FlagOpt) CommandOpt

NewFlag builds a flag and adds it to a Command. It panics if a flag with the same name exists

Jump to

Keyboard shortcuts

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