cmdutil

package
v0.1.2 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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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