cobrautil

package module
v0.0.0-...-acdfead Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 6 Imported by: 18

README

cobrautil

util package to help with https://github.com/spf13/cobra.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisallowExtraArgs

func DisallowExtraArgs(cmd *cobra.Command)

func FlagHelpSectionsUsageTemplate

func FlagHelpSectionsUsageTemplate(sections []FlagHelpSection) string

func HelpSectionsUsageTemplate

func HelpSectionsUsageTemplate(sections []HelpSection) string

func IsCobraManagedCommand

func IsCobraManagedCommand(args []string) bool

func ReconfigureCmdWithSubcmd

func ReconfigureCmdWithSubcmd(cmd *cobra.Command)

func ResolveFlagsForCmd

func ResolveFlagsForCmd(cmd *cobra.Command, args []string) error

func ShowHelp

func ShowHelp(cmd *cobra.Command, args []string) error

func ShowSubcommands

func ShowSubcommands(cmd *cobra.Command, args []string) error

func VisitCommands

func VisitCommands(cmd *cobra.Command, fns ...ReconfigureFunc)

Types

type FlagHelpSection

type FlagHelpSection struct {
	Title string

	PrefixMatch string
	ExactMatch  []string
	NoneMatch   bool
}

func (FlagHelpSection) Matches

func (s FlagHelpSection) Matches(name string) bool

type HelpSection

type HelpSection struct {
	Key   string
	Value string
	Title string
}

type ReconfigureFunc

type ReconfigureFunc func(cmd *cobra.Command)

func ReconfigureLeafCmds

func ReconfigureLeafCmds(fs ...func(cmd *cobra.Command)) ReconfigureFunc

func WrapRunEForCmd

func WrapRunEForCmd(additionalRunE func(*cobra.Command, []string) error) ReconfigureFunc

type ResolvableFlag

type ResolvableFlag interface {
	Resolve() error
}

Jump to

Keyboard shortcuts

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