cmdutil

package
v1.1.4-beta Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 19 Imported by: ? modules, 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 ErrCancel = errors.New("Error: cancelled")

ErrCancel signals user-initiated cancellation

View Source
var ErrSilent = errors.New("Error: silent")

ErrSilent is an error that triggers exit code 1 without any error messaging

View Source
var IndexSettings = []string{
	"advancedSyntax",
	"advancedSyntaxFeatures",
	"allowCompressionOfIntegerArray",
	"allowTyposOnNumericTokens",
	"alternativesAsExact",
	"attributeCriteriaComputedByMinProximity",
	"attributesForFaceting",
	"attributesToHighlight",
	"attributesToRetrieve",
	"attributesToSnippet",
	"attributesToTransliterate",
	"camelCaseAttributes",
	"customRanking",
	"decompoundQuery",
	"decompoundedAttributes",
	"disableExactOnAttributes",
	"disablePrefixOnAttributes",
	"disableTypoToleranceOnAttributes",
	"disableTypoToleranceOnWords",
	"distinct",
	"enablePersonalization",
	"enableRules",
	"exactOnSingleWordQuery",
	"highlightPostTag",
	"highlightPreTag",
	"hitsPerPage",
	"ignorePlurals",
	"indexLanguages",
	"keepDiacriticsOnCharacters",
	"maxFacetHits",
	"minProximity",
	"minWordSizefor1Typo",
	"minWordSizefor2Typos",
	"numericAttributesForFiltering",
	"optionalWords",
	"paginationLimitedTo",
	"queryLanguages",
	"queryType",
	"ranking",
	"relevancyStrictness",
	"removeStopWords",
	"removeWordsIfNoResults",
	"renderingContent",
	"replaceSynonymsInHighlight",
	"replicas",
	"responseFields",
	"restrictHighlightAndSnippetArrays",
	"restrictSearchableAttributes",
	"searchableAttributes",
	"separatorsToIndex",
	"snippetEllipsisText",
	"synonyms",
	"typoTolerance",
	"unretrievableAttributes",
	"userData",
}
View Source
var SearchParamsObject = []string{
	"advancedSyntax",
	"advancedSyntaxFeatures",
	"allowTyposOnNumericTokens",
	"alternativesAsExact",
	"analytics",
	"analyticsTags",
	"aroundLatLng",
	"aroundLatLngViaIP",
	"aroundPrecision",
	"aroundRadius",
	"attributeCriteriaComputedByMinProximity",
	"attributesForFaceting",
	"attributesToHighlight",
	"attributesToRetrieve",
	"attributesToSnippet",
	"clickAnalytics",
	"customRanking",
	"decompoundQuery",
	"disableExactOnAttributes",
	"disableTypoToleranceOnAttributes",
	"distinct",
	"enableABTest",
	"enablePersonalization",
	"enableReRanking",
	"enableRules",
	"exactOnSingleWordQuery",
	"facetFilters",
	"facetingAfterDistinct",
	"facets",
	"filters",
	"getRankingInfo",
	"highlightPostTag",
	"highlightPreTag",
	"hitsPerPage",
	"ignorePlurals",
	"insideBoundingBox",
	"insidePolygon",
	"keepDiacriticsOnCharacters",
	"length",
	"maxFacetHits",
	"maxValuesPerFacet",
	"minProximity",
	"minWordSizefor1Typo",
	"minWordSizefor2Typos",
	"minimumAroundRadius",
	"naturalLanguages",
	"numericFilters",
	"offset",
	"optionalFilters",
	"optionalWords",
	"page",
	"percentileComputation",
	"personalizationImpact",
	"query",
	"queryLanguages",
	"queryType",
	"ranking",
	"reRankingApplyFilter",
	"relevancyStrictness",
	"removeStopWords",
	"removeWordsIfNoResults",
	"renderingContent",
	"replaceSynonymsInHighlight",
	"responseFields",
	"restrictHighlightAndSnippetArrays",
	"restrictSearchableAttributes",
	"ruleContexts",
	"similarQuery",
	"snippetEllipsisText",
	"sortFacetValuesBy",
	"sumOrFiltersScores",
	"synonyms",
	"tagFilters",
	"typoTolerance",
	"unretrievableAttributes",
	"userToken",
}

Functions

func AddIndexSettingsFlags

func AddIndexSettingsFlags(cmd *cobra.Command)

func AddSearchParamsObjectFlags

func AddSearchParamsObjectFlags(cmd *cobra.Command)

func CheckAuth

func CheckAuth(cfg config.Config) error

func ConfiguredProfilesCompletionFunc

func ConfiguredProfilesCompletionFunc(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

func DisableAuthCheck

func DisableAuthCheck(cmd *cobra.Command)

func FlagErrorWrap

func FlagErrorWrap(err error) error

FlagError returns a new FlagError that wraps the specified error.

func FlagErrorf

func FlagErrorf(format string, args ...interface{}) error

FlagErrorf returns a new FlagError that wraps an error produced by fmt.Errorf(format, args...).

func FlagValuesMap

func FlagValuesMap(flags *pflag.FlagSet, only ...string) (map[string]interface{}, error)

FlagValuesMap returns a map of flag values for the given FlagSet.

func IndexNames

func IndexNames(clientF func() (*search.Client, error)) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

IndexNames returns a function to list the index names from the given search client.

func IsAuthCheckEnabled

func IsAuthCheckEnabled(cmd *cobra.Command) bool

func IsNoCompatiblePrinterError

func IsNoCompatiblePrinterError(err error) bool

IsNoCompatiblePrinterError returns true if it is a not a compatible printer otherwise it will return false

func IsUserCancellation

func IsUserCancellation(err error) bool

func MutuallyExclusive

func MutuallyExclusive(message string, conditions ...bool) error

func ReadFile

func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)

func ScanFile

func ScanFile(filename string, stdin io.ReadCloser) (*bufio.Scanner, error)

func ShouldTrackUsage

func ShouldTrackUsage(cmd *cobra.Command) bool

Types

type CategoryFlagSet

type CategoryFlagSet struct {
	Categories map[string]*pflag.FlagSet
	Print      *pflag.FlagSet
	Others     *pflag.FlagSet
}

func NewCategoryFlagSet

func NewCategoryFlagSet(flags *pflag.FlagSet) *CategoryFlagSet

func (*CategoryFlagSet) SortedCategoryNames

func (c *CategoryFlagSet) SortedCategoryNames() []string

type Factory

type Factory struct {
	IOStreams    *iostreams.IOStreams
	Config       config.IConfig
	SearchClient func() (*search.Client, error)

	ExecutableName string
}

func (*Factory) Executable

func (f *Factory) Executable() string

Executable is the path to the currently invoked binary

type FlagError

type FlagError struct {
	// Note: not struct{error}: only *FlagError should satisfy error.
	Err error
}

A *FlagError indicates an error processing command-line flags or other arguments. Such errors cause the application to display the usage message.

func (*FlagError) Error

func (fe *FlagError) Error() string

func (*FlagError) Unwrap

func (fe *FlagError) Unwrap() error

type JSONPathPrintFlags

type JSONPathPrintFlags struct {
	// indicates if it is OK to ignore missing keys for rendering
	// an output template.
	AllowMissingKeys *bool
	TemplateArgument *string
}

JSONPathPrintFlags provides default flags necessary for template printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.

func NewJSONPathPrintFlags

func NewJSONPathPrintFlags() *JSONPathPrintFlags

NewJSONPathPrintFlags returns flags associated with --template printing, with default values set.

func (*JSONPathPrintFlags) AddFlags

func (f *JSONPathPrintFlags) AddFlags(c *cobra.Command)

AddFlags receives a *cobra.Command reference and binds flags related to template printing to it

func (*JSONPathPrintFlags) AllowedFormats

func (f *JSONPathPrintFlags) AllowedFormats() []string

AllowedFormats returns slice of string of allowed JSONPath printing format

func (*JSONPathPrintFlags) ToPrinter

func (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (printers.Printer, error)

ToPrinter receives an templateFormat and returns a printer capable of handling --template format printing. Returns false if the specified templateFormat does not match a template format.

type JSONPrintFlags

type JSONPrintFlags struct{}

func NewJSONPrintFlags

func NewJSONPrintFlags() *JSONPrintFlags

func (*JSONPrintFlags) AddFlags

func (f *JSONPrintFlags) AddFlags(c *cobra.Command)

func (*JSONPrintFlags) AllowedFormats

func (f *JSONPrintFlags) AllowedFormats() []string

func (*JSONPrintFlags) ToPrinter

func (f *JSONPrintFlags) ToPrinter(outputFormat string) (printers.Printer, error)

type JSONValue

type JSONValue struct {
	Value interface{}
	// contains filtered or unexported fields
}

JSONValue is a flag.Value that marshals a JSON object into a string.

func NewJSONVar

func NewJSONVar(types ...string) *JSONValue

NewJSONValue creates a new JSONVar.

func (*JSONValue) Set

func (j *JSONValue) Set(s string) error

Set parses the JSON string into the value.

func (*JSONValue) String

func (j *JSONValue) String() string

String returns the string representation of the JSON object.

func (*JSONValue) Type

func (j *JSONValue) Type() string

Type returns the type of the value.

type NoCompatiblePrinterError

type NoCompatiblePrinterError struct {
	OutputFormat   *string
	AllowedFormats []string
	Options        interface{}
}

NoCompatiblePrinterError is a struct that contains error information. It will be constructed when a invalid printing format is provided

func (NoCompatiblePrinterError) Error

func (e NoCompatiblePrinterError) Error() string

type PrintFlags

type PrintFlags struct {
	JSONPrintFlags     *JSONPrintFlags
	JSONPathPrintFlags *JSONPathPrintFlags

	OutputFormat        *string
	OutputFlagSpecified func() bool
}

func NewPrintFlags

func NewPrintFlags() *PrintFlags

NewPrintFlags returns a default *PrintFlags

func (*PrintFlags) AddFlags

func (f *PrintFlags) AddFlags(cmd *cobra.Command)

func (*PrintFlags) AllowedFormats

func (f *PrintFlags) AllowedFormats() []string

func (*PrintFlags) ToPrinter

func (f *PrintFlags) ToPrinter() (printers.Printer, error)

func (*PrintFlags) WithDefaultOutput

func (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags

WithDefaultOutput sets a default output format if one is not provided through a flag value

Jump to

Keyboard shortcuts

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