mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 22:47:43 +02:00
Auto-generate markdown command docs (#4451)
* Finish updating * a couple improvements * Update renames * cleanup examples
This commit is contained in:
@ -1,32 +1,38 @@
|
||||
# fetch
|
||||
---
|
||||
title: fetch
|
||||
layout: command
|
||||
version: 0.59.0
|
||||
---
|
||||
|
||||
This command loads from a URL into a cell, convert it to table if possible (avoid by appending `--raw` flag)
|
||||
Fetch the contents from a URL (HTTP GET operation).
|
||||
|
||||
## Signature
|
||||
|
||||
```> fetch (URL) --user --password --timeout --headers --raw```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `URL`: the URL to fetch the contents from
|
||||
- `--user {any}`: the username when authenticating
|
||||
- `--password {any}`: the password when authenticating
|
||||
- `--timeout {int}`: timeout period in seconds
|
||||
- `--headers {any}`: custom headers you want to add
|
||||
- `--raw`: fetch contents as text rather than a table
|
||||
|
||||
## Examples
|
||||
|
||||
Fetch content from url.com
|
||||
```shell
|
||||
> fetch http://headers.jsontest.com
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
X-Cloud-Trace-Context │ Accept │ Host │ Content-Length │ user-agent
|
||||
───────────────────────────────────────────────────────┼────────┼──────────────────────┼────────────────┼─────────────────────────
|
||||
aeee1a8abf08820f6fe19d114dc3bb87/16772233176633589121 │ */* │ headers.jsontest.com │ 0 │ curl/7.54.0 isahc/0.7.1
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
> fetch http://headers.jsontest.com --raw
|
||||
{
|
||||
"X-Cloud-Trace-Context": "aeee1a8abf08820f6fe19d114dc3bb87/16772233176633589121",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
|
||||
"Host": "headers.jsontest.com",
|
||||
"Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8"
|
||||
}
|
||||
> fetch url.com
|
||||
```
|
||||
|
||||
Fetch content from url.com, with username and password
|
||||
```shell
|
||||
> fetch https://www.jonathanturner.org/feed.xml
|
||||
━━━━━━━━━━━━━━━━
|
||||
rss
|
||||
────────────────
|
||||
[table: 1 row]
|
||||
━━━━━━━━━━━━━━━━
|
||||
> fetch -u myuser -p mypass url.com
|
||||
```
|
||||
|
||||
Fetch content from url.com, with custom header
|
||||
```shell
|
||||
> fetch -H [my-header-key my-header-value] url.com
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user