Documentation
¶
Index ¶
- Variables
- func AddBrowseParamsObjectFlags(cmd *cobra.Command)
- func AddDeleteByParamsFlags(cmd *cobra.Command)
- func AddIndexSettingsFlags(cmd *cobra.Command)
- func AddSearchParamsObjectFlags(cmd *cobra.Command)
- func ApplyNonInteractive(ios *iostreams.IOStreams, printFlags *PrintFlags)
- func ConfiguredProfilesCompletionFunc(f *Factory) ...
- func CrawlerIDs(clientF func() (*crawler.Client, error)) ...
- func Dedent(s string) string
- func FlagErrorWrap(err error) error
- func FlagErrorf(format string, args ...interface{}) error
- func FlagValuesMap(flags *pflag.FlagSet, only ...string) (map[string]interface{}, error)
- func IndexNames(clientF func() (*search.APIClient, error)) ...
- func IsNoCompatiblePrinterError(err error) bool
- func IsUserCancellation(err error) bool
- func MutuallyExclusive(message string, conditions ...bool) error
- func PrintRunSummary(ios *iostreams.IOStreams, printFlags *PrintFlags, summary interface{}, ...) error
- func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)
- func RedirectHumanOutput(ios *iostreams.IOStreams) func()
- func ScanFile(filename string, stdin io.ReadCloser) (*bufio.Scanner, error)
- func ShouldTrackUsage(cmd *cobra.Command) bool
- func StringCompletionFunc(allowedMap map[string]string) ...
- func StringSliceCompletionFunc(allowedMap map[string]string, prefixAllDescription string) ...
- func UsageFunc(IOStreams *iostreams.IOStreams, command *cobra.Command, flagUsages string) func(cmd *cobra.Command) error
- func UsageFuncDefault(IOStreams *iostreams.IOStreams, command *cobra.Command) func(cmd *cobra.Command) error
- func UsageFuncWithFilteredAndInheritedFlags(IOStreams *iostreams.IOStreams, command *cobra.Command, ...) func(cmd *cobra.Command) error
- func UsageFuncWithFilteredFlags(IOStreams *iostreams.IOStreams, command *cobra.Command, ...) func(cmd *cobra.Command) error
- func UsageFuncWithInheritedFlagsOnly(IOStreams *iostreams.IOStreams, command *cobra.Command) func(cmd *cobra.Command) error
- func ValidateNoControlChars(field, value string) error
- type CategoryFlagSet
- type Factory
- type FlagError
- type JSONPathPrintFlags
- type JSONPrintFlags
- type JSONValue
- type NoCompatiblePrinterError
- type PrintFlags
- func (f *PrintFlags) AddFlags(cmd *cobra.Command)
- func (f *PrintFlags) AllowedFormats() []string
- func (f *PrintFlags) HasStructuredOutput() bool
- func (f *PrintFlags) Print(ios *iostreams.IOStreams, value interface{}) error
- func (f *PrintFlags) ToPrinter() (printers.Printer, error)
- func (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags
- type UsageEntries
- func (u *UsageEntries) AddAllFlags(IOStreams *iostreams.IOStreams, command *cobra.Command, flagUsages string)
- func (u *UsageEntries) AddBasicUsage(IOStreams *iostreams.IOStreams, command *cobra.Command)
- func (u *UsageEntries) AddEntry(entry UsageEntry)
- func (u *UsageEntries) AddFilteredFlags(IOStreams *iostreams.IOStreams, command *cobra.Command, ...)
- func (u *UsageEntries) AddFlags(IOStreams *iostreams.IOStreams, command *cobra.Command, flagUsages string)
- func (u *UsageEntries) AddInheritedFlags(IOStreams *iostreams.IOStreams, command *cobra.Command)
- func (u *UsageEntries) DisplayEntries(out io.Writer)
- type UsageEntry
Constants ¶
This section is empty.
Variables ¶
var BrowseParamsObject = []string{
"advancedSyntax",
"advancedSyntaxFeatures",
"allowTyposOnNumericTokens",
"alternativesAsExact",
"analytics",
"analyticsTags",
"aroundLatLng",
"aroundLatLngViaIP",
"aroundPrecision",
"aroundRadius",
"attributeCriteriaComputedByMinProximity",
"attributesToHighlight",
"attributesToRetrieve",
"attributesToSnippet",
"clickAnalytics",
"cursor",
"decompoundQuery",
"disableExactOnAttributes",
"disableTypoToleranceOnAttributes",
"distinct",
"enableABTest",
"enablePersonalization",
"enableReRanking",
"enableRules",
"exactOnSingleWordQuery",
"facetFilters",
"facetingAfterDistinct",
"facets",
"filters",
"getRankingInfo",
"highlightPostTag",
"highlightPreTag",
"hitsPerPage",
"ignorePlurals",
"insideBoundingBox",
"insidePolygon",
"length",
"maxValuesPerFacet",
"minProximity",
"minWordSizefor1Typo",
"minWordSizefor2Typos",
"minimumAroundRadius",
"mode",
"naturalLanguages",
"numericFilters",
"offset",
"optionalFilters",
"optionalWords",
"page",
"percentileComputation",
"personalizationImpact",
"query",
"queryLanguages",
"queryType",
"ranking",
"reRankingApplyFilter",
"relevancyStrictness",
"removeStopWords",
"removeWordsIfNoResults",
"renderingContent",
"replaceSynonymsInHighlight",
"responseFields",
"restrictHighlightAndSnippetArrays",
"restrictSearchableAttributes",
"ruleContexts",
"semanticSearch",
"similarQuery",
"snippetEllipsisText",
"sortFacetValuesBy",
"sumOrFiltersScores",
"synonyms",
"tagFilters",
"typoTolerance",
"userToken",
}
var DeleteByParams = []string{
"aroundLatLng",
"aroundRadius",
"facetFilters",
"filters",
"insideBoundingBox",
"insidePolygon",
"numericFilters",
"tagFilters",
}
var ErrCancel = errors.New("Error: cancelled")
ErrCancel signals user-initiated cancellation
var ErrSilent = errors.New("Error: silent")
ErrSilent is an error that triggers exit code 1 without any error messaging
var IndexSettings = []string{
"advancedSyntax",
"advancedSyntaxFeatures",
"allowCompressionOfIntegerArray",
"allowTyposOnNumericTokens",
"alternativesAsExact",
"attributeCriteriaComputedByMinProximity",
"attributeForDistinct",
"attributesForFaceting",
"attributesToHighlight",
"attributesToRetrieve",
"attributesToSnippet",
"attributesToTransliterate",
"camelCaseAttributes",
"customNormalization",
"customRanking",
"decompoundQuery",
"decompoundedAttributes",
"disableExactOnAttributes",
"disablePrefixOnAttributes",
"disableTypoToleranceOnAttributes",
"disableTypoToleranceOnWords",
"distinct",
"enablePersonalization",
"enableReRanking",
"enableRules",
"exactOnSingleWordQuery",
"highlightPostTag",
"highlightPreTag",
"hitsPerPage",
"ignorePlurals",
"indexLanguages",
"keepDiacriticsOnCharacters",
"maxFacetHits",
"maxValuesPerFacet",
"minProximity",
"minWordSizefor1Typo",
"minWordSizefor2Typos",
"mode",
"numericAttributesForFiltering",
"optionalWords",
"paginationLimitedTo",
"queryLanguages",
"queryType",
"ranking",
"reRankingApplyFilter",
"relevancyStrictness",
"removeStopWords",
"removeWordsIfNoResults",
"renderingContent",
"replaceSynonymsInHighlight",
"replicas",
"responseFields",
"restrictHighlightAndSnippetArrays",
"searchableAttributes",
"semanticSearch",
"separatorsToIndex",
"snippetEllipsisText",
"sortFacetValuesBy",
"typoTolerance",
"unretrievableAttributes",
"userData",
}
var SearchParamsObject = []string{
"advancedSyntax",
"advancedSyntaxFeatures",
"allowTyposOnNumericTokens",
"alternativesAsExact",
"analytics",
"analyticsTags",
"aroundLatLng",
"aroundLatLngViaIP",
"aroundPrecision",
"aroundRadius",
"attributeCriteriaComputedByMinProximity",
"attributesToHighlight",
"attributesToRetrieve",
"attributesToSnippet",
"clickAnalytics",
"decompoundQuery",
"disableExactOnAttributes",
"disableTypoToleranceOnAttributes",
"distinct",
"enableABTest",
"enablePersonalization",
"enableReRanking",
"enableRules",
"exactOnSingleWordQuery",
"facetFilters",
"facetingAfterDistinct",
"facets",
"filters",
"getRankingInfo",
"highlightPostTag",
"highlightPreTag",
"hitsPerPage",
"ignorePlurals",
"insideBoundingBox",
"insidePolygon",
"length",
"maxValuesPerFacet",
"minProximity",
"minWordSizefor1Typo",
"minWordSizefor2Typos",
"minimumAroundRadius",
"mode",
"naturalLanguages",
"numericFilters",
"offset",
"optionalFilters",
"optionalWords",
"page",
"percentileComputation",
"personalizationImpact",
"query",
"queryLanguages",
"queryType",
"ranking",
"reRankingApplyFilter",
"relevancyStrictness",
"removeStopWords",
"removeWordsIfNoResults",
"renderingContent",
"replaceSynonymsInHighlight",
"responseFields",
"restrictHighlightAndSnippetArrays",
"restrictSearchableAttributes",
"ruleContexts",
"semanticSearch",
"similarQuery",
"snippetEllipsisText",
"sortFacetValuesBy",
"sumOrFiltersScores",
"synonyms",
"tagFilters",
"typoTolerance",
"userToken",
}
Functions ¶
func AddBrowseParamsObjectFlags ¶ added in v1.2.1
func AddDeleteByParamsFlags ¶ added in v1.3.0
func AddIndexSettingsFlags ¶
func ApplyNonInteractive ¶ added in v1.16.0
func ApplyNonInteractive(ios *iostreams.IOStreams, printFlags *PrintFlags)
ApplyNonInteractive turns off every prompt and defaults the output to JSON, leaving an explicit --output untouched. printFlags may be nil, for commands that expose no output flags.
func CrawlerIDs ¶ added in v1.4.0
func CrawlerIDs( clientF func() (*crawler.Client, error), ) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CrawlerIDs returns a function to list the crawler IDs from the given crawler client.
func FlagErrorWrap ¶
FlagError returns a new FlagError that wraps the specified error.
func FlagErrorf ¶
FlagErrorf returns a new FlagError that wraps an error produced by fmt.Errorf(format, args...).
func FlagValuesMap ¶
FlagValuesMap returns a map of flag values for the given FlagSet.
func IndexNames ¶
func IndexNames( clientF func() (*search.APIClient, 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 IsNoCompatiblePrinterError ¶
IsNoCompatiblePrinterError returns true if it is a not a compatible printer otherwise it will return false
func IsUserCancellation ¶
func MutuallyExclusive ¶
func PrintRunSummary ¶ added in v1.8.0
func PrintRunSummary( ios *iostreams.IOStreams, printFlags *PrintFlags, summary interface{}, human string, ) error
PrintRunSummary prints a structured summary when an output format is requested, otherwise it falls back to a human-readable line.
func RedirectHumanOutput ¶ added in v1.16.0
RedirectHumanOutput sends the progress narration a command writes to stdout to stderr instead, so stdout carries nothing but the structured document.
The returned function restores the original writer and must run before the document is printed.
func ShouldTrackUsage ¶
func StringCompletionFunc ¶ added in v1.3.0
func StringSliceCompletionFunc ¶ added in v1.3.0
func StringSliceCompletionFunc( allowedMap map[string]string, prefixAllDescription string, ) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
Inspired from https://github.com/cli/cli/blob/trunk/pkg/cmdutil/json_flags.go#L26
func UsageFuncDefault ¶ added in v1.2.1
func UsageFuncWithFilteredAndInheritedFlags ¶ added in v1.2.1
func UsageFuncWithFilteredFlags ¶ added in v1.2.1
func UsageFuncWithInheritedFlagsOnly ¶ added in v1.2.1
func ValidateNoControlChars ¶ added in v1.8.0
ValidateNoControlChars rejects identifier-like inputs containing control characters, which are easy to miss in automation and should never be valid.
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.APIClient, error)
CrawlerClient func() (*crawler.Client, error)
CompositionClient func() (*composition.APIClient, error)
// Prompter is the interactive input source used by commands that support
// an --interactive mode. Defaulted to a real SurveyPrompter in factory.New;
// tests set it to an interactive.ScriptedPrompter.
Prompter interactive.Prompter
ExecutableName string
}
func (*Factory) Executable ¶
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.
type JSONPathPrintFlags ¶
type JSONPathPrintFlags struct {
// Indicates if it's 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 formats
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
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.
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 (*PrintFlags) AddFlags ¶
func (f *PrintFlags) AddFlags(cmd *cobra.Command)
func (*PrintFlags) AllowedFormats ¶
func (f *PrintFlags) AllowedFormats() []string
func (*PrintFlags) HasStructuredOutput ¶ added in v1.8.0
func (f *PrintFlags) HasStructuredOutput() bool
HasStructuredOutput returns true when the command is configured to emit a machine-readable format, either through an explicit flag or a default output.
func (*PrintFlags) Print ¶ added in v1.8.0
func (f *PrintFlags) Print(ios *iostreams.IOStreams, value interface{}) error
Print renders a value with the configured printer.
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
type UsageEntries ¶ added in v1.2.1
type UsageEntries struct {
// contains filtered or unexported fields
}
func (*UsageEntries) AddAllFlags ¶ added in v1.2.1
func (*UsageEntries) AddBasicUsage ¶ added in v1.2.1
func (u *UsageEntries) AddBasicUsage(IOStreams *iostreams.IOStreams, command *cobra.Command)
func (*UsageEntries) AddEntry ¶ added in v1.2.1
func (u *UsageEntries) AddEntry(entry UsageEntry)
func (*UsageEntries) AddFilteredFlags ¶ added in v1.2.1
func (*UsageEntries) AddInheritedFlags ¶ added in v1.2.1
func (u *UsageEntries) AddInheritedFlags(IOStreams *iostreams.IOStreams, command *cobra.Command)
func (*UsageEntries) DisplayEntries ¶ added in v1.2.1
func (u *UsageEntries) DisplayEntries(out io.Writer)