Crates.io | fetch-cli |
lib.rs | fetch-cli |
version | |
source | src |
created_at | 2024-10-06 03:24:20.350732 |
updated_at | 2025-02-06 01:49:53.294145 |
description | fetch is a modern HTTP(S) client for the command line |
homepage | |
repository | https://github.com/ryanfowler/fetch |
max_upload_size | |
id | 1398696 |
Cargo.toml error: | TOML parse error at line 26, column 1 | 26 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
fetch
is a modern HTTP(S) client for the command line.
Its features include:
Download the binary for your os and architecture here.
cargo
cargo install --force --locked fetch-cli
Clone this repository:
git clone https://github.com/ryanfowler/fetch.git
Then build with Cargo:
cargo install --force --locked --path .
# Make a simple GET request
# fetch will default to using HTTPS if no scheme is specified
fetch example.com
# Make a PUT request with inline body
fetch -m PUT --data 'request body' example.com
# Make a PUT request with inline JSON body
# The --json flag will set the content-type header to 'application/json'
fetch -m PUT --json --data '{"key":"val"}' example.com
# Send a request body from a local file
# The content-type will automatically be inferred from the file extension
fetch -m PUT --data '@local/image.jpeg' example.com
# Use an editor to define the JSON request body
fetch -m PUT --json --edit example.com
# By default, fetch will write the HTTP version and status to stderr.
fetch example.com
# HTTP/1.1 200 OK
#
# [response data]
# Providing the verbose flag a single time will also output the response headers
fetch -v example.com
# HTTP/1.1 200 OK
# date: Sat, 05 Oct 2024 04:42:51 GMT
# content-type: application/json; charset=utf-8
# content-length: 456
#
# [response data]
# Providing the verbose flag twice will also output the request headers
fetch -vv example.com
# GET / HTTP/1.1
# host: example.com
# accept: */*
# accept-encoding: gzip, deflate, br, zstd
# user-agent: fetch/0.1.0
#
# HTTP/1.1 200 OK
# date: Sat, 05 Oct 2024 04:42:51 GMT
# content-type: application/json; charset=utf-8
# content-length: 456
#
# [response data]
# If you don't want any metadata written to stderr, use the silent flag
fetch -s example.com
# [response data]
# Set a custom request header for the request in the 'key:value' format
fetch -H x-custom-header:value1 example.com
# Set multiple request headers
fetch -H x-custom-header:value1 -H x-another-header:value2 example.com
# Append a query parameter to the request in the 'key=value' format
fetch -q key=value example.com
# Parameters will be appended to any exist query parameters on the request
fetch -q key1=value1 -q key2=value2 "example.com?existing=param"
# Send a POST request with a form body.
# Sets the content-type to 'application/x-www-form-urlencoded'
fetch -m POST -f key1=value1 -f key2=value2 example.com
# Write the response body to a local file
fetch example.com -o 'local/file.txt'
# Write the response body to a file, disabling the progress bar
fetch example.com -o 'local/file.txt' -s
# Sign a request with aws signature v4.
# This will set the authorization, x-amz-date, and optionally the x-amz-content-sha256 headers
export AWS_ACCESS_KEY_ID=AWSACCESSKEYID
export AWS_SECRET_ACCESS_KEY=SEcrETAccESSkEY
fetch mybucket.example.com --aws-sigv4 us-east-1/s3
Images will be automatically rendered in your terminal.
High quality images will be rendered in the following terminals:
Low quality block-based images will be rendered in all other terminal emulators.
Supported image types are: