{"modulePath":"github.com/ryanfowler/fetch","version":"v0.28.0","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package cli\n\n## Functions\n\n```go\nfunc RequestBody(value string) (io.Reader, string, error)\n```\n\n## Types\n\n```go\ntype App struct {\n\tURL           *url.URL\n\tExtraArgs     []string\n\tSchemelessURL bool\n\n\tCfg config.Config\n\n\tAWSSigv4         *aws.Config\n\tBasic            *core.KeyVal[string]\n\tBearer           string\n\tDigest           *core.KeyVal[string]\n\tBuildInfo        bool\n\tClobber          bool\n\tComplete         string\n\tConfigPath       string\n\tContentType      string\n\tData             io.Reader\n\tDiscard          bool\n\tDryRun           bool\n\tEdit             bool\n\tArticle          bool\n\tForm             []core.KeyVal[string]\n\tFromCurl         string\n\tGRPC             bool\n\tGRPCDescribe     string\n\tGRPCList         bool\n\tHAR              string\n\tHelp             bool\n\tInspectDNS       bool\n\tInspectTLS       bool\n\tSkill            bool\n\tInstallSkill     string\n\tUninstallSkill   string\n\tScope            string\n\tForce            bool\n\tSortHeaders      bool\n\tWS               bool // set when URL scheme is ws:// or wss://\n\tMethod           string\n\tMultipart        []core.KeyVal[string]\n\tOutput           string\n\tProtoDesc        string\n\tProtoFiles       []string\n\tProtoImports     []string\n\tRange            []string\n\tRemoteHeaderName bool\n\tRemoteName       bool\n\tUnixSocket       string\n\tUpdate           bool\n\tCheckUpdate      bool\n\tVersion          bool\n\tWSInteractive    core.WSInteractiveMode\n\tWSMessageMode    core.WSMessageMode\n\t// contains filtered or unexported fields\n}\n```\nApp represents the full configuration for a fetch invocation.\n\n```go\nfunc Parse(args []string) (*App, error)\n```\n\n```go\nfunc (a *App) CLI() *CLI\n```\n\n```go\nfunc (a *App) HasGRPCDiscovery() bool\n```\n\n```go\nfunc (a *App) HasGRPCMode() bool\n```\n\n```go\nfunc (a *App) HasProtoSchema() bool\n```\n\n```go\nfunc (a *App) OptionProvenance(name string) OptionProvenance\n```\nOptionProvenance returns the sources that contributed to a canonical option in this invocation. A flag's declared default is reported separately by the registry and is not stored as mutable App state.\n\n```go\nfunc (a *App) OptionWasExplicit(name string) bool\n```\nOptionWasExplicit reports whether the user supplied an option directly or through curl import. Config defaults deliberately do not count.\n\n```go\nfunc (a *App) PrintHelp(p *core.Printer)\n```\n\n```go\nfunc (a *App) RecordConfigKeys(keys []string, source OptionSource)\n```\nRecordConfigKeys records only the fields that won a particular merge. This avoids reporting lower-precedence scalar settings as if they contributed.\n\n```go\nfunc (a *App) RecordConfigSource(c *config.Config, source OptionSource)\n```\nRecordConfigSource records populated config fields after they have been merged. Calling this once per scope preserves global versus host provenance without making Config itself stateful.\n\n```go\nfunc (a *App) RecordEnvironment(name string)\n```\nRecordEnvironment records an environment-derived option for integrations that select environment-backed defaults outside the INI parser.\n\n```go\ntype Arguments struct {\n\tName        string\n\tDescription string\n}\n```\n\n```go\ntype CLI struct {\n\tDescription    string\n\tArgFn          func(s string) error\n\tArgs           []Arguments\n\tFlags          []Flag\n\tExclusiveFlags [][]string\n\tRequiredFlags  []core.KeyVal[[]string]\n\n\t// SchemeExclusiveFlags maps URL schemes (e.g. \"ws\", \"wss\") to flags\n\t// that cannot be used with that scheme.\n\tSchemeExclusiveFlags map[string][]string\n\n\t// FromCurlExclusiveFlags lists flags that cannot be used alongside\n\t// --from-curl.\n\tFromCurlExclusiveFlags []string\n\n\t// OnOptionSet receives the canonical option name after a successful\n\t// explicit CLI parse. It is used to preserve source provenance.\n\tOnOptionSet func(canonical string)\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (cli *CLI) Options() *OptionRegistry\n```\nOptions returns the registry for this CLI definition. The registry is cached so all consumers of one definition see the same enriched metadata.\n\n```go\ntype Flag struct {\n\tShort       string\n\tLong        string\n\tAliases     []string\n\tAliasValues map[string]string\n\tArgs        string\n\tOptionalArg bool\n\tDescription string\n\tDefault     string\n\tValues      []core.KeyVal[string]\n\tHideValues  bool\n\tIsHidden    bool\n\tIsSet       func() bool\n\tOS          []string\n\tFn          func(value string) error\n\n\t// Registry metadata. These fields keep the option contract next to the\n\t// parser definition so validation, help, completion, and diagnostics share\n\t// the same source of truth.\n\tConfigKey     string\n\tRepeatable    bool\n\tSchemes       []string\n\tModes         []OptionMode\n\tConflicts     []string\n\tRequires      []string\n\tIgnoredIn     []OptionMode\n\tIgnoreLabel   string\n\tFromCurl      bool\n\tUnsupportedIn []OptionMode\n}\n```\n\n```go\nfunc (f Flag) WithAliasValues(values map[string]string) Flag\n```\nWithAliasValues gives aliases that normally take an argument a fixed value. It is used for compatibility shorthands such as --http2, which is exactly equivalent to --http 2 but has no separate argument.\n\n```go\nfunc (f Flag) WithAliases(aliases ...string) Flag\n```\nWithAliases adds aliases to the Flag.\n\n```go\nfunc (f Flag) WithDefault(def string) Flag\n```\nWithDefault sets the default value shown in help.\n\n```go\nfunc (f Flag) WithHidden(hidden bool) Flag\n```\nWithHidden marks the flag as hidden from help output.\n\n```go\nfunc (f Flag) WithHideValues() Flag\n```\nWithHideValues hides the accepted values from help output.\n\n```go\nfunc (f Flag) WithOS(os []string) Flag\n```\nWithOS restricts the flag to specific operating systems.\n\n```go\nfunc (f Flag) WithValues(values []core.KeyVal[string]) Flag\n```\nWithValues sets the accepted values for the Flag.\n\n```go\ntype OptionMode string\n```\nOptionMode is a user-visible command or request mode understood by the option registry.\n\n```go\nconst (\n\tModeMetadata      OptionMode = \"metadata\"\n\tModeHTTP          OptionMode = \"http\"\n\tModeGRPC          OptionMode = \"grpc\"\n\tModeGRPCDiscovery OptionMode = \"grpc-discovery\"\n\tModeWebSocket     OptionMode = \"websocket\"\n\tModeDNSInspection OptionMode = \"dns-inspection\"\n\tModeTLSInspection OptionMode = \"tls-inspection\"\n\tModeUpdate        OptionMode = \"update\"\n\tModeSkill         OptionMode = \"skill\"\n)\n```\n\n```go\ntype OptionProvenance struct {\n\tSources []OptionSource\n}\n```\nOptionProvenance records every source that contributed a value to an option. Multiple sources may be present after config merging.\n\n```go\nfunc (p OptionProvenance) Has(source OptionSource) bool\n```\n\n```go\ntype OptionRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nOptionRegistry is the single index of the public option surface. Aliases resolve to the canonical long name while retaining the original Flag for parsing and completion.\n\n```go\nfunc (r *OptionRegistry) Flags() []Flag\n```\nFlags returns the registry-enriched flags in their declared order.\n\n```go\nfunc (r *OptionRegistry) Ignored(mode OptionMode, explicit func(string) bool) []string\n```\nIgnored returns canonical option labels for a mode, filtered to options explicitly supplied by the user. Config-only values are intentionally not returned.\n\n```go\nfunc (r *OptionRegistry) LongFlags() map[string]Flag\n```\n\n```go\nfunc (r *OptionRegistry) Lookup(name string) (Flag, bool)\n```\n\n```go\nfunc (r *OptionRegistry) ShortFlags() map[string]Flag\n```\n\n```go\nfunc (r *OptionRegistry) String() string\n```\n\n```go\nfunc (r *OptionRegistry) Unsupported(mode OptionMode) (string, bool)\n```\n\n```go\nfunc (r *OptionRegistry) Validate() error\n```\nValidate checks registry-declared conflicts and requirements using the canonical names even when the user supplied an alias.\n\n```go\nfunc (r *OptionRegistry) ValidateScheme(scheme string) error\n```\n\n```go\ntype OptionSource uint8\n```\nOptionSource identifies where an option value came from. Sources are kept on App rather than Config because a Config can be merged from several scopes before a request is executed.\n\n```go\nconst (\n\tSourceDefault OptionSource = iota\n\tSourceGlobalConfig\n\tSourceHostConfig\n\tSourceEnvironment\n\tSourceCurl\n\tSourceCLI\n)\n```\n\n","path":"github.com/ryanfowler/fetch/internal/cli","name":"cli","synopsis":"","isRedistributable":true}
