{"modulePath":"github.com/algolia/cli","version":"v1.18.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cmdutil\n\n## Variables\n\n```go\nvar BrowseParamsObject = []string{\n\t\"advancedSyntax\",\n\t\"advancedSyntaxFeatures\",\n\t\"allowTyposOnNumericTokens\",\n\t\"alternativesAsExact\",\n\t\"analytics\",\n\t\"analyticsTags\",\n\t\"aroundLatLng\",\n\t\"aroundLatLngViaIP\",\n\t\"aroundPrecision\",\n\t\"aroundRadius\",\n\t\"attributeCriteriaComputedByMinProximity\",\n\t\"attributesToHighlight\",\n\t\"attributesToRetrieve\",\n\t\"attributesToSnippet\",\n\t\"clickAnalytics\",\n\t\"cursor\",\n\t\"decompoundQuery\",\n\t\"disableExactOnAttributes\",\n\t\"disableTypoToleranceOnAttributes\",\n\t\"distinct\",\n\t\"enableABTest\",\n\t\"enablePersonalization\",\n\t\"enableReRanking\",\n\t\"enableRules\",\n\t\"exactOnSingleWordQuery\",\n\t\"facetFilters\",\n\t\"facetingAfterDistinct\",\n\t\"facets\",\n\t\"filters\",\n\t\"getRankingInfo\",\n\t\"highlightPostTag\",\n\t\"highlightPreTag\",\n\t\"hitsPerPage\",\n\t\"ignorePlurals\",\n\t\"insideBoundingBox\",\n\t\"insidePolygon\",\n\t\"length\",\n\t\"maxValuesPerFacet\",\n\t\"minProximity\",\n\t\"minWordSizefor1Typo\",\n\t\"minWordSizefor2Typos\",\n\t\"minimumAroundRadius\",\n\t\"mode\",\n\t\"naturalLanguages\",\n\t\"numericFilters\",\n\t\"offset\",\n\t\"optionalFilters\",\n\t\"optionalWords\",\n\t\"page\",\n\t\"percentileComputation\",\n\t\"personalizationImpact\",\n\t\"query\",\n\t\"queryLanguages\",\n\t\"queryType\",\n\t\"ranking\",\n\t\"reRankingApplyFilter\",\n\t\"relevancyStrictness\",\n\t\"removeStopWords\",\n\t\"removeWordsIfNoResults\",\n\t\"renderingContent\",\n\t\"replaceSynonymsInHighlight\",\n\t\"responseFields\",\n\t\"restrictHighlightAndSnippetArrays\",\n\t\"restrictSearchableAttributes\",\n\t\"ruleContexts\",\n\t\"semanticSearch\",\n\t\"similarQuery\",\n\t\"snippetEllipsisText\",\n\t\"sortFacetValuesBy\",\n\t\"sumOrFiltersScores\",\n\t\"synonyms\",\n\t\"tagFilters\",\n\t\"typoTolerance\",\n\t\"userToken\",\n}\n```\n\n```go\nvar DeleteByParams = []string{\n\t\"aroundLatLng\",\n\t\"aroundRadius\",\n\t\"facetFilters\",\n\t\"filters\",\n\t\"insideBoundingBox\",\n\t\"insidePolygon\",\n\t\"numericFilters\",\n\t\"tagFilters\",\n}\n```\n\n```go\nvar ErrCancel = errors.New(\"Error: cancelled\")\n```\nErrCancel signals user-initiated cancellation\n\n```go\nvar ErrSilent = errors.New(\"Error: silent\")\n```\nErrSilent is an error that triggers exit code 1 without any error messaging\n\n```go\nvar IndexSettings = []string{\n\t\"advancedSyntax\",\n\t\"advancedSyntaxFeatures\",\n\t\"allowCompressionOfIntegerArray\",\n\t\"allowTyposOnNumericTokens\",\n\t\"alternativesAsExact\",\n\t\"attributeCriteriaComputedByMinProximity\",\n\t\"attributeForDistinct\",\n\t\"attributesForFaceting\",\n\t\"attributesToHighlight\",\n\t\"attributesToRetrieve\",\n\t\"attributesToSnippet\",\n\t\"attributesToTransliterate\",\n\t\"camelCaseAttributes\",\n\t\"customNormalization\",\n\t\"customRanking\",\n\t\"decompoundQuery\",\n\t\"decompoundedAttributes\",\n\t\"disableExactOnAttributes\",\n\t\"disablePrefixOnAttributes\",\n\t\"disableTypoToleranceOnAttributes\",\n\t\"disableTypoToleranceOnWords\",\n\t\"distinct\",\n\t\"enablePersonalization\",\n\t\"enableReRanking\",\n\t\"enableRules\",\n\t\"exactOnSingleWordQuery\",\n\t\"highlightPostTag\",\n\t\"highlightPreTag\",\n\t\"hitsPerPage\",\n\t\"ignorePlurals\",\n\t\"indexLanguages\",\n\t\"keepDiacriticsOnCharacters\",\n\t\"maxFacetHits\",\n\t\"maxValuesPerFacet\",\n\t\"minProximity\",\n\t\"minWordSizefor1Typo\",\n\t\"minWordSizefor2Typos\",\n\t\"mode\",\n\t\"numericAttributesForFiltering\",\n\t\"optionalWords\",\n\t\"paginationLimitedTo\",\n\t\"queryLanguages\",\n\t\"queryType\",\n\t\"ranking\",\n\t\"reRankingApplyFilter\",\n\t\"relevancyStrictness\",\n\t\"removeStopWords\",\n\t\"removeWordsIfNoResults\",\n\t\"renderingContent\",\n\t\"replaceSynonymsInHighlight\",\n\t\"replicas\",\n\t\"responseFields\",\n\t\"restrictHighlightAndSnippetArrays\",\n\t\"searchableAttributes\",\n\t\"semanticSearch\",\n\t\"separatorsToIndex\",\n\t\"snippetEllipsisText\",\n\t\"sortFacetValuesBy\",\n\t\"typoTolerance\",\n\t\"unretrievableAttributes\",\n\t\"userData\",\n}\n```\n\n```go\nvar SearchParamsObject = []string{\n\t\"advancedSyntax\",\n\t\"advancedSyntaxFeatures\",\n\t\"allowTyposOnNumericTokens\",\n\t\"alternativesAsExact\",\n\t\"analytics\",\n\t\"analyticsTags\",\n\t\"aroundLatLng\",\n\t\"aroundLatLngViaIP\",\n\t\"aroundPrecision\",\n\t\"aroundRadius\",\n\t\"attributeCriteriaComputedByMinProximity\",\n\t\"attributesToHighlight\",\n\t\"attributesToRetrieve\",\n\t\"attributesToSnippet\",\n\t\"clickAnalytics\",\n\t\"decompoundQuery\",\n\t\"disableExactOnAttributes\",\n\t\"disableTypoToleranceOnAttributes\",\n\t\"distinct\",\n\t\"enableABTest\",\n\t\"enablePersonalization\",\n\t\"enableReRanking\",\n\t\"enableRules\",\n\t\"exactOnSingleWordQuery\",\n\t\"facetFilters\",\n\t\"facetingAfterDistinct\",\n\t\"facets\",\n\t\"filters\",\n\t\"getRankingInfo\",\n\t\"highlightPostTag\",\n\t\"highlightPreTag\",\n\t\"hitsPerPage\",\n\t\"ignorePlurals\",\n\t\"insideBoundingBox\",\n\t\"insidePolygon\",\n\t\"length\",\n\t\"maxValuesPerFacet\",\n\t\"minProximity\",\n\t\"minWordSizefor1Typo\",\n\t\"minWordSizefor2Typos\",\n\t\"minimumAroundRadius\",\n\t\"mode\",\n\t\"naturalLanguages\",\n\t\"numericFilters\",\n\t\"offset\",\n\t\"optionalFilters\",\n\t\"optionalWords\",\n\t\"page\",\n\t\"percentileComputation\",\n\t\"personalizationImpact\",\n\t\"query\",\n\t\"queryLanguages\",\n\t\"queryType\",\n\t\"ranking\",\n\t\"reRankingApplyFilter\",\n\t\"relevancyStrictness\",\n\t\"removeStopWords\",\n\t\"removeWordsIfNoResults\",\n\t\"renderingContent\",\n\t\"replaceSynonymsInHighlight\",\n\t\"responseFields\",\n\t\"restrictHighlightAndSnippetArrays\",\n\t\"restrictSearchableAttributes\",\n\t\"ruleContexts\",\n\t\"semanticSearch\",\n\t\"similarQuery\",\n\t\"snippetEllipsisText\",\n\t\"sortFacetValuesBy\",\n\t\"sumOrFiltersScores\",\n\t\"synonyms\",\n\t\"tagFilters\",\n\t\"typoTolerance\",\n\t\"userToken\",\n}\n```\n\n## Functions\n\n```go\nfunc AddBrowseParamsObjectFlags(cmd *cobra.Command)\n```\n\n```go\nfunc AddDeleteByParamsFlags(cmd *cobra.Command)\n```\n\n```go\nfunc AddIndexSettingsFlags(cmd *cobra.Command)\n```\n\n```go\nfunc AddSearchParamsObjectFlags(cmd *cobra.Command)\n```\n\n```go\nfunc ApplyNonInteractive(ios *iostreams.IOStreams, printFlags *PrintFlags)\n```\nApplyNonInteractive 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.\n\n```go\nfunc ConfiguredProfilesCompletionFunc(\n\tf *Factory,\n) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)\n```\n\n```go\nfunc CrawlerIDs(\n\tclientF func() (*crawler.Client, error),\n) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)\n```\nCrawlerIDs returns a function to list the crawler IDs from the given crawler client.\n\n```go\nfunc Dedent(s string) string\n```\n\n```go\nfunc FlagErrorWrap(err error) error\n```\nFlagError returns a new FlagError that wraps the specified error.\n\n```go\nfunc FlagErrorf(format string, args ...interface{}) error\n```\nFlagErrorf returns a new FlagError that wraps an error produced by fmt.Errorf(format, args...).\n\n```go\nfunc FlagValuesMap(flags *pflag.FlagSet, only ...string) (map[string]interface{}, error)\n```\nFlagValuesMap returns a map of flag values for the given FlagSet.\n\n```go\nfunc IndexNames(\n\tclientF func() (*search.APIClient, error),\n) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)\n```\nIndexNames returns a function to list the index names from the given search client.\n\n```go\nfunc IsNoCompatiblePrinterError(err error) bool\n```\nIsNoCompatiblePrinterError returns true if it is a not a compatible printer otherwise it will return false\n\n```go\nfunc IsUserCancellation(err error) bool\n```\n\n```go\nfunc MutuallyExclusive(message string, conditions ...bool) error\n```\n\n```go\nfunc PrintRunSummary(\n\tios *iostreams.IOStreams,\n\tprintFlags *PrintFlags,\n\tsummary interface{},\n\thuman string,\n) error\n```\nPrintRunSummary prints a structured summary when an output format is requested, otherwise it falls back to a human-readable line.\n\n```go\nfunc ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)\n```\n\n```go\nfunc RedirectHumanOutput(ios *iostreams.IOStreams) func()\n```\nRedirectHumanOutput sends the progress narration a command writes to stdout to stderr instead, so stdout carries nothing but the structured document.\n\nThe returned function restores the original writer and must run before the document is printed.\n\n```go\nfunc ScanFile(filename string, stdin io.ReadCloser) (*bufio.Scanner, error)\n```\n\n```go\nfunc ShouldTrackUsage(cmd *cobra.Command) bool\n```\n\n```go\nfunc StringCompletionFunc(\n\tallowedMap map[string]string,\n) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)\n```\n\n```go\nfunc StringSliceCompletionFunc(\n\tallowedMap map[string]string,\n\tprefixAllDescription string,\n) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)\n```\nInspired from [https://github.com/cli/cli/blob/trunk/pkg/cmdutil/json\\_flags.go#L26](https://github.com/cli/cli/blob/trunk/pkg/cmdutil/json_flags.go#L26)\n\n```go\nfunc UsageFunc(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagUsages string,\n) func(cmd *cobra.Command) error\n```\n\n```go\nfunc UsageFuncDefault(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n) func(cmd *cobra.Command) error\n```\n\n```go\nfunc UsageFuncWithFilteredAndInheritedFlags(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagsToDisplay []string,\n) func(cmd *cobra.Command) error\n```\n\n```go\nfunc UsageFuncWithFilteredFlags(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagsToDisplay []string,\n) func(cmd *cobra.Command) error\n```\n\n```go\nfunc UsageFuncWithInheritedFlagsOnly(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n) func(cmd *cobra.Command) error\n```\n\n```go\nfunc ValidateNoControlChars(field, value string) error\n```\nValidateNoControlChars rejects identifier-like inputs containing control characters, which are easy to miss in automation and should never be valid.\n\n## Types\n\n```go\ntype CategoryFlagSet struct {\n\tCategories map[string]*pflag.FlagSet\n\tPrint      *pflag.FlagSet\n\tOthers     *pflag.FlagSet\n}\n```\n\n```go\nfunc NewCategoryFlagSet(flags *pflag.FlagSet) *CategoryFlagSet\n```\n\n```go\nfunc (c *CategoryFlagSet) SortedCategoryNames() []string\n```\n\n```go\ntype Factory struct {\n\tIOStreams         *iostreams.IOStreams\n\tConfig            config.IConfig\n\tSearchClient      func() (*search.APIClient, error)\n\tCrawlerClient     func() (*crawler.Client, error)\n\tCompositionClient func() (*composition.APIClient, error)\n\tAgentStudioClient func() (*agentStudio.APIClient, error)\n\n\t// Prompter is the interactive input source used by commands that support\n\t// an --interactive mode. Defaulted to a real SurveyPrompter in factory.New;\n\t// tests set it to an interactive.ScriptedPrompter.\n\tPrompter       interactive.Prompter\n\tExecutableName string\n}\n```\n\n```go\nfunc (f *Factory) Executable() string\n```\nExecutable is the path to the currently invoked binary\n\n```go\ntype FlagError struct {\n\t// Note: not struct{error}: only *FlagError should satisfy error.\n\tErr error\n}\n```\nA \\*FlagError indicates an error processing command-line flags or other arguments. Such errors cause the application to display the usage message.\n\n```go\nfunc (fe *FlagError) Error() string\n```\n\n```go\nfunc (fe *FlagError) Unwrap() error\n```\n\n```go\ntype JSONPathPrintFlags struct {\n\t// Indicates if it's OK to ignore missing keys for rendering\n\t// an output template.\n\tAllowMissingKeys *bool\n\tTemplateArgument *string\n}\n```\nJSONPathPrintFlags 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.\n\n```go\nfunc NewJSONPathPrintFlags() *JSONPathPrintFlags\n```\nNewJSONPathPrintFlags returns flags associated with --template printing, with default values set.\n\n```go\nfunc (f *JSONPathPrintFlags) AddFlags(c *cobra.Command)\n```\nAddFlags receives a \\*cobra.Command reference and binds flags related to template printing to it\n\n```go\nfunc (f *JSONPathPrintFlags) AllowedFormats() []string\n```\nAllowedFormats returns slice of string of allowed JSONPath printing formats\n\n```go\nfunc (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (printers.Printer, error)\n```\nToPrinter 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.\n\n```go\ntype JSONPrintFlags struct{}\n```\n\n```go\nfunc NewJSONPrintFlags() *JSONPrintFlags\n```\n\n```go\nfunc (f *JSONPrintFlags) AddFlags(c *cobra.Command)\n```\n\n```go\nfunc (f *JSONPrintFlags) AllowedFormats() []string\n```\n\n```go\nfunc (f *JSONPrintFlags) ToPrinter(outputFormat string) (printers.Printer, error)\n```\n\n```go\ntype JSONValue struct {\n\tValue interface{}\n\t// contains filtered or unexported fields\n}\n```\nJSONValue is a flag.Value that marshals a JSON object into a string.\n\n```go\nfunc NewJSONVar(types ...string) *JSONValue\n```\nNewJSONValue creates a new JSONVar.\n\n```go\nfunc (j *JSONValue) Set(s string) error\n```\nSet parses the JSON string into the value.\n\n```go\nfunc (j *JSONValue) String() string\n```\nString returns the string representation of the JSON object.\n\n```go\nfunc (j *JSONValue) Type() string\n```\nType returns the type of the value.\n\n```go\ntype NoCompatiblePrinterError struct {\n\tOutputFormat   *string\n\tAllowedFormats []string\n\tOptions        interface{}\n}\n```\nNoCompatiblePrinterError is a struct that contains error information. It will be constructed when a invalid printing format is provided\n\n```go\nfunc (e NoCompatiblePrinterError) Error() string\n```\n\n```go\ntype PrintFlags struct {\n\tJSONPrintFlags     *JSONPrintFlags\n\tJSONPathPrintFlags *JSONPathPrintFlags\n\n\tOutputFormat        *string\n\tOutputFlagSpecified func() bool\n}\n```\n\n```go\nfunc NewPrintFlags() *PrintFlags\n```\nNewPrintFlags returns a default \\*PrintFlags\n\n```go\nfunc (f *PrintFlags) AddFlags(cmd *cobra.Command)\n```\n\n```go\nfunc (f *PrintFlags) AllowedFormats() []string\n```\n\n```go\nfunc (f *PrintFlags) HasStructuredOutput() bool\n```\nHasStructuredOutput returns true when the command is configured to emit a machine-readable format, either through an explicit flag or a default output.\n\n```go\nfunc (f *PrintFlags) Print(ios *iostreams.IOStreams, value interface{}) error\n```\nPrint renders a value with the configured printer.\n\n```go\nfunc (f *PrintFlags) ToPrinter() (printers.Printer, error)\n```\n\n```go\nfunc (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags\n```\nWithDefaultOutput sets a default output format if one is not provided through a flag value\n\n```go\ntype UsageEntries struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (u *UsageEntries) AddAllFlags(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagUsages string,\n)\n```\n\n```go\nfunc (u *UsageEntries) AddBasicUsage(IOStreams *iostreams.IOStreams, command *cobra.Command)\n```\n\n```go\nfunc (u *UsageEntries) AddEntry(entry UsageEntry)\n```\n\n```go\nfunc (u *UsageEntries) AddFilteredFlags(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagsToDisplay []string,\n)\n```\n\n```go\nfunc (u *UsageEntries) AddFlags(\n\tIOStreams *iostreams.IOStreams,\n\tcommand *cobra.Command,\n\tflagUsages string,\n)\n```\n\n```go\nfunc (u *UsageEntries) AddInheritedFlags(IOStreams *iostreams.IOStreams, command *cobra.Command)\n```\n\n```go\nfunc (u *UsageEntries) DisplayEntries(out io.Writer)\n```\n\n```go\ntype UsageEntry struct {\n\tTitle string\n\tBody  string\n}\n```\n\n","path":"github.com/algolia/cli/pkg/cmdutil","name":"cmdutil","synopsis":"","isRedistributable":true}
