cmdutil

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSilent  = errors.New("silent")
	ErrPending = errors.New("pending")
)

Functions

func FlagValue

func FlagValue(cmd *cobra.Command, name string) string

FlagValue returns the value for the named flag if it exists.

func HostKeyFromURL

func HostKeyFromURL(baseURL string) (string, error)

func NewHTTPClient

func NewHTTPClient(host *config.Host, storeCode string) (*httpx.Client, error)

NewHTTPClient constructs a raw HTTP client for the configured host.

func NewMagentoClient

func NewMagentoClient(host *config.Host, storeCode string) (*magento.Client, error)

NewMagentoClient constructs a Magento API client from the resolved context.

func NormalizeBaseURL

func NormalizeBaseURL(raw string) (string, error)

func NotImplemented

func NotImplemented(cmd *cobra.Command) error

func ResolveContext

func ResolveContext(f *Factory, cmd *cobra.Command, override string) (string, *config.Context, *config.Host, error)

ResolveContext fetches the context and host configuration given an optional override name (typically provided via --context).

func ResolveHost

func ResolveHost(f *Factory, contextOverride, hostOverride string) (string, *config.Host, error)

ResolveHost locates a host configuration using optional context or host overrides.

func WriteOutput

func WriteOutput(cmd *cobra.Command, w io.Writer, data any, fallback func() error) error

Types

type ExitError

type ExitError struct {
	Code int
	Msg  string
}

func (*ExitError) Error

func (e *ExitError) Error() string

type Factory

type Factory struct {
	AppVersion     string
	ExecutableName string

	IOStreams *iostreams.IOStreams

	Config func() (*config.Config, error)

	Browser  browser.Browser
	Pager    pager.Manager
	Prompter prompter.Interface
	Spinner  progress.Spinner
	// contains filtered or unexported fields
}

func (*Factory) BrowserOpener

func (f *Factory) BrowserOpener() browser.Browser

func (*Factory) PagerManager

func (f *Factory) PagerManager() pager.Manager

func (*Factory) ProgressSpinner

func (f *Factory) ProgressSpinner() progress.Spinner

func (*Factory) Prompt

func (f *Factory) Prompt() prompter.Interface

func (*Factory) ResolveConfig

func (f *Factory) ResolveConfig() (*config.Config, error)

func (*Factory) Streams

func (f *Factory) Streams() (*iostreams.IOStreams, error)

type OutputSettings

type OutputSettings struct {
	Format   string
	JQ       string
	Template string
}

func ResolveOutputSettings

func ResolveOutputSettings(cmd *cobra.Command) (OutputSettings, error)

Jump to

Keyboard shortcuts

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