cli

package
v1.8.17 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC3339NanoFixed  = "2006-01-02T15:04:05.000000000Z07:00"
	RFC3339MilliFixed = "2006-01-02T15:04:05.000Z07:00"
)

Variables

View Source
var StandardSetupContext = NewSetupContext(Module, nil)

Functions

func GetClientOptions added in v1.8.14

func GetClientOptions(scope scope.Scope) ([]rig.Option, error)

func MakeTestModule added in v1.8.9

func MakeTestModule(i TestModuleInput) fx.Option

func SkipFX

func SkipFX(cmd *cobra.Command) bool

Types

type ContextDependency added in v1.8.14

type ContextDependency interface{}

type F

type F = func(cmd *cobra.Command, args []string) error

func CtxWrap

func CtxWrap(f FCtx) F

type FComplete

type FComplete = func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

func CtxWrapCompletion

func CtxWrapCompletion(f FCompleteCtx) FComplete

func HackCtxWrapCompletion added in v1.8.9

func HackCtxWrapCompletion(f FCompleteCtxSetup, s *SetupContext) FComplete

func HackWrapCompletion added in v1.8.9

func HackWrapCompletion(f FCompleteSetup, s *SetupContext) FComplete

type FCompleteCtx

type FCompleteCtx = func(context.Context, *cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

type FCompleteCtxSetup added in v1.8.9

type FCompleteCtxSetup = func(context.Context, *cobra.Command, []string, string, *SetupContext) ([]string, cobra.ShellCompDirective)

type FCompleteSetup added in v1.8.9

type FCompleteSetup = func(*cobra.Command, []string, string, *SetupContext) ([]string, cobra.ShellCompDirective)

type FCtx

type FCtx = func(ctx context.Context, cmd *cobra.Command, args []string) error

type PromptInformation

type PromptInformation struct {
	ContextCreation bool
}

type SetupContext added in v1.8.9

type SetupContext struct {
	BaseModule     fx.Option
	Args           []string
	AddTestCommand bool
	// contains filtered or unexported fields
}

func NewSetupContext added in v1.8.10

func NewSetupContext(baseModule fx.Option, args []string) *SetupContext

func (*SetupContext) AddOptions added in v1.8.9

func (s *SetupContext) AddOptions(opts ...fx.Option)

func (*SetupContext) ExecuteInvokes added in v1.8.9

func (s *SetupContext) ExecuteInvokes(cmd *cobra.Command, args []string, invokes ...any) error

func (*SetupContext) InvokePreRunE added in v1.8.9

func (s *SetupContext) InvokePreRunE(cmd *cobra.Command, args []string, invokes ...any) error

IvokePreRunE registers FX invokes to be executed at the time a corresponding PreRunE would have been executed by Cobra had we not used FX.

func (*SetupContext) MakeInvokePreRunE added in v1.8.9

func (s *SetupContext) MakeInvokePreRunE(invokes ...any) func(cmd *cobra.Command, args []string) error

MakeInvokePreRunE constructs a PreRunE function signature which registers the supplied invokes to be executed at the time Cobra would have executed the returned PreRunE if we did not use FX at all.

func (*SetupContext) PersistentPreRunE added in v1.8.9

func (s *SetupContext) PersistentPreRunE(cmd *cobra.Command, args []string) error

PersistentPreRunE solves the issue described at the top of the file. It assumes all PreRunEs on the command chain has been wrapped in FX invokes and registered using InvokePreRunE. When Cobra starts executing PreRunEs, the following happens: If the current PreRunE being executed is not the last one, we simply do nothing. If the current PreRunE is the last one in the chain, we call FX to build all dependencies and run all Invokes. It is only at this point we know exactly which dependencies are needed. It is assumed the Cobra main Run function has had its dependencies initialized by one of the Invokes registered.

type TestModuleInput added in v1.8.9

type TestModuleInput struct {
	RigClient     rig.Client
	IsInteractive bool
	Prompter      common.Prompter
	FS            afero.Fs
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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