id = "curl" name = "curl" homepage = "https://curl.se" description = "A command line tool and library for transferring data with URL syntax." icon = "SimpleIcons:curl" executables = ["curl"] [dotfiles] # curl(1) under --config: with no -K on the command line curl looks for a # default config file, trying "$CURL_HOME/.curlrc", then # "$XDG_CONFIG_HOME/curlrc" (added in 7.73.0), then "$HOME/.curlrc". On # Windows it also checks "%USERPROFILE%\.curlrc" and "%APPDATA%\.curlrc", and # in every directory it accepts both the ".curlrc" and the "_curlrc" # spelling, preferring the former. The %USERPROFILE% pair is spelled "~/" # here — the two are the same directory and the same fixture file, so listing # both would leave a rule that can never name every spelling it has to. # $CURL_HOME is not listed either: it names a directory the consumer cannot # resolve. paths = [ "~/.curlrc", "~/_curlrc", "~/.config/curlrc", "%APPDATA%/.curlrc", "%APPDATA%/_curlrc", ] exclude = [] # curl(1) under --netrc: "Make curl scan the .netrc file in the user's home # directory for login name and password". The whole file is login names and # passwords. secret = ["~/.netrc"] # Parsed once at startup by a process that then exits; rewriting it mid # transfer cannot disturb anything. side_effect = false # cacert and capath name a CA bundle installed on this machine — /etc/ssl on # one distro, a Homebrew prefix on the next, a drive letter on Windows. That # is the platform deciding, not the machine: every box of the same kind # installs the bundle in the same place, so the line travels to one of those # and nowhere else. Every spelling is listed: a rule naming only the # first is a rule that does not run for a user whose file is one of the # others, and curl reads whichever it finds. [[dotfiles.machine_lines]] file = [ "~/.curlrc", "~/_curlrc", "~/.config/curlrc", "%APPDATA%/.curlrc", "%APPDATA%/_curlrc", ] match = { prefix = ["cacert", "capath"] } scope = "platform" # No secret_paths on the curlrc itself. A `user = "name:password"` line is # possible, but the match syntax is a prefix and "user" also opens # "user-agent", which is a preference every machine should keep. Marking the # credential would mean marking the user agent too, so the consumer's own # content scan is the right layer for it. [commands] format = 1 label = "Transfer a URL" description = "Make an HTTP request or download a URL. Other protocols, TLS tuning, proxies and multi-URL sessions are left out." quality = "ai-draft" base = "fig:curl" parser = { end_of_options = "--", interleave = "permute", long_equals = false, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/curl.ts" license = "MIT" [[commands.field]] id = "url" label = "URL" type = "url" position = 0 sources = ["fig"] [[commands.field]] id = "method" label = "Method" type = "string" option = ["--request", "-X"] suggestions = [{ value = "GET", label = "GET" }, { value = "POST", label = "POST" }, { value = "PUT", label = "PUT" }, { value = "PATCH", label = "PATCH" }, { value = "DELETE", label = "DELETE" }, { value = "HEAD", label = "HEAD" }] sources = ["fig"] [[commands.field]] id = "header" label = "Headers" description = "One header per entry, for example Content-Type: application/json." type = "string" option = ["--header", "-H"] multiple = true suggestions = [{ value = "Content-Type: application/json", label = "JSON body" }, { value = "Accept: application/json", label = "Accept JSON" }] sources = ["fig"] [[commands.field]] id = "data" label = "Request body" description = "Send as POST data. Prefix with @ to read from a file." type = "string" option = ["--data", "-d"] multiple = true sources = ["fig"] [[commands.field]] id = "user" label = "User" description = "user:password for server authentication." type = "string" option = ["--user", "-u"] sources = ["fig"] [[commands.field]] id = "output" label = "Output file" type = "path" option = ["--output", "-o"] path = { kind = "file", role = "output", must_exist = false } effect = "overwrite" sources = ["fig"] [[commands.field]] id = "remote_name" label = "Save with remote name" type = "boolean" option = ["--remote-name", "-O"] sources = ["fig"] [[commands.field]] id = "location" label = "Follow redirects" type = "boolean" option = ["--location", "-L"] sources = ["fig"] [[commands.field]] id = "silent" label = "Silent" type = "boolean" option = ["--silent", "-s"] sources = ["fig"] [[commands.field]] id = "show_error" label = "Show errors when silent" type = "boolean" option = ["--show-error", "-S"] sources = ["fig"] [[commands.field]] id = "fail" label = "Fail on HTTP errors" type = "boolean" option = ["--fail", "-f"] sources = ["fig"] [[commands.field]] id = "include" label = "Include response headers" type = "boolean" option = ["--include", "-i"] sources = ["fig"] [[commands.field]] id = "head" label = "Headers only" type = "boolean" option = ["--head", "-I"] sources = ["fig"] [[commands.field]] id = "verbose" label = "Verbose" type = "boolean" option = ["--verbose", "-v"] sources = ["fig"] [[commands.field]] id = "insecure" label = "Skip TLS verification" type = "boolean" option = ["--insecure", "-k"] effect = "exec" sources = ["fig"] [[commands.field]] id = "max_time" label = "Max time (seconds)" type = "integer" option = ["--max-time", "-m"] sources = ["fig"] [[commands.task]] id = "download" label = "Download a file" set = { location = [true], remote_name = [true] } fields = ["url", "location", "remote_name", "output", "fail"] required = ["url"] [[commands.task]] id = "post-json" label = "POST JSON" set = { method = ["POST"], header = ["Content-Type: application/json"] } fields = ["url", "method", "header", "data", "silent", "show_error"] required = ["url", "data"] [[commands.task]] id = "inspect-headers" label = "Inspect response headers" set = { head = [true], location = [true] } fields = ["url", "head", "location"] required = ["url"] [[commands.group]] id = "basic" label = "Basic" fields = ["url", "method", "header", "data", "output", "remote_name", "location"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["user", "silent", "show_error", "fail", "include", "head", "verbose", "insecure", "max_time"]