remove non ascii whitespaces
This commit is contained in:
parent
598a10bc28
commit
5a6d6c4d13
117 changed files with 1928 additions and 1928 deletions
|
@ -5,7 +5,7 @@ website: https://sqlitebrowser.org
|
|||
repo: https://github.com/sqlitebrowser/sqlitebrowser
|
||||
---
|
||||
# DB Browser for SQLite
|
||||
_DB Browser for SQLite_ (DB4S) is a high quality, visual, open source tool to create, design, and edit database files compatible with [SQLite](../../dev/programming/SQLite.md).
|
||||
_DB Browser for SQLite_ (DB4S) is a high quality, visual, open source tool to create, design, and edit database files compatible with [SQLite](../../dev/programming/SQLite.md).
|
||||
|
||||
DB4S is for users and developers who want to create, search, and edit databases. DB4S uses a familiar spreadsheet-like interface, and complicated [SQL](../../dev/programming/languages/SQL.md) commands do not have to be learned.
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ http [flags] [METHOD] URL [ITEM [ITEM]]
|
|||
```
|
||||
|
||||
### Querystring parameters
|
||||
If you find yourself manually constructing URLs with querystring parameters on the terminal, you may appreciate the `param==value` syntax for appending [URL](../../internet/URL.md) parameters.
|
||||
If you find yourself manually constructing URLs with querystring parameters on the terminal, you may appreciate the `param==value` syntax for appending [URL](../../internet/URL.md) parameters.
|
||||
|
||||
With that, you don’t have to worry about escaping the `&` separators for your [shell](../cli/Shell.md). Additionally, any special characters in the parameter name or value get automatically [URL](../../internet/URL.md)-escaped (as opposed to the parameters specified in the full [URL](../../internet/URL.md), which HTTPie doesn’t modify).
|
||||
With that, you don’t have to worry about escaping the `&` separators for your [shell](../cli/Shell.md). Additionally, any special characters in the parameter name or value get automatically [URL](../../internet/URL.md)-escaped (as opposed to the parameters specified in the full [URL](../../internet/URL.md), which HTTPie doesn’t modify).
|
||||
```shell
|
||||
$ http https://api.github.com/search/repositories q==httpie per_page==1
|
||||
```
|
||||
|
@ -33,16 +33,16 @@ GET /search/repositories?q=httpie&per_page=1 HTTP/1.1
|
|||
### Request Items
|
||||
| Item Type | Description |
|
||||
| ------------------------------------------------------------:| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| HTTP Headers `Name:Value` | Arbitrary [HTTP](../../internet/HTTP.md) header, e.g. `X-API-Token:123` |
|
||||
| [URL](../../internet/URL.md) parameters `name==value` | Appends the given name/value pair as a querystring parameter to the [URL](../../internet/URL.md). The `==` separator is used. |
|
||||
| Data Fields `field=value` | Request data fields to be serialized as a [JSON](../../files/JSON.md) object (default), to be form-encoded (with `--form, -f`), or to be serialized as `multipart/form-data` (with `--multipart`) |
|
||||
| Raw JSON fields `field:=json` | Useful when sending [JSON](../../files/JSON.md) and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:=[1,2,3]` (note the quotes) |
|
||||
| File upload fields `field@/dir/file`, `field@file;type=mime` | Only available with `--form`, `-f` and `--multipart`. For example `screenshot@~/Pictures/img.png`, or `'cv@cv.txt;type=text/markdown'`. With `--form`, the presence of a file field results in a `--multipart` request |
|
||||
| HTTP Headers `Name:Value` | Arbitrary [HTTP](../../internet/HTTP.md) header, e.g. `X-API-Token:123` |
|
||||
| [URL](../../internet/URL.md) parameters `name==value` | Appends the given name/value pair as a querystring parameter to the [URL](../../internet/URL.md). The `==` separator is used. |
|
||||
| Data Fields `field=value` | Request data fields to be serialized as a [JSON](../../files/JSON.md) object (default), to be form-encoded (with `--form, -f`), or to be serialized as `multipart/form-data` (with `--multipart`) |
|
||||
| Raw JSON fields `field:=json` | Useful when sending [JSON](../../files/JSON.md) and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:=[1,2,3]` (note the quotes) |
|
||||
| File upload fields `field@/dir/file`, `field@file;type=mime` | Only available with `--form`, `-f` and `--multipart`. For example `screenshot@~/Pictures/img.png`, or `'cv@cv.txt;type=text/markdown'`. With `--form`, the presence of a file field results in a `--multipart` request |
|
||||
|
||||
### JSON Requests
|
||||
Data is send as [JSON](../../files/JSON.md) by default.
|
||||
|
||||
Non-string [JSON](../../files/JSON.md) fields use the `:=` separator, which allows you to embed arbitrary [JSON](../../files/JSON.md) data into the resulting [JSON](../../files/JSON.md) object. Additionally, text and raw [JSON](../../files/JSON.md) files can also be embedded into fields using `=@` and `:=@`:
|
||||
Non-string [JSON](../../files/JSON.md) fields use the `:=` separator, which allows you to embed arbitrary [JSON](../../files/JSON.md) data into the resulting [JSON](../../files/JSON.md) object. Additionally, text and raw [JSON](../../files/JSON.md) files can also be embedded into fields using `=@` and `:=@`:
|
||||
```shell
|
||||
$ http PUT pie.dev/put \
|
||||
name=John \ # String (default)
|
||||
|
@ -79,7 +79,7 @@ Host: pie.dev
|
|||
```
|
||||
|
||||
### Forms
|
||||
Submitting forms is very similar to sending [JSON](../../files/JSON.md) requests. Often the only difference is in adding the `--form, -f` option, which ensures that data fields are serialized as, and `Content-Type` is set to `application/x-www-form-urlencoded; charset=utf-8`.
|
||||
Submitting forms is very similar to sending [JSON](../../files/JSON.md) requests. Often the only difference is in adding the `--form, -f` option, which ensures that data fields are serialized as, and `Content-Type` is set to `application/x-www-form-urlencoded; charset=utf-8`.
|
||||
|
||||
#### Regular forms
|
||||
```shell
|
||||
|
@ -94,7 +94,7 @@ name=John+Smith
|
|||
```
|
||||
|
||||
#### File upload forms
|
||||
If one or more file fields is present, the serialization and content type is `multipart/form-data`:
|
||||
If one or more file fields is present, the serialization and content type is `multipart/form-data`:
|
||||
```shell
|
||||
$ http -f POST pie.dev/post name='John Smith' cv@~/files/data.xml
|
||||
```
|
||||
|
@ -107,7 +107,7 @@ The request above is the same as if the following [HTML](../../internet/HTML.md)
|
|||
</form>
|
||||
```
|
||||
|
||||
Please note that `@` is used to simulate a file upload form field, whereas `=@` just embeds the file content as a regular text field value.
|
||||
Please note that `@` is used to simulate a file upload form field, whereas `=@` just embeds the file content as a regular text field value.
|
||||
|
||||
When uploading files, their content type is inferred from the file name. You can manually override the inferred content type:
|
||||
```shell
|
||||
|
@ -115,7 +115,7 @@ $ http -f POST pie.dev/post name='John Smith' cv@'~/files/data.bin;type=applicat
|
|||
```
|
||||
|
||||
### HTTP headers
|
||||
To set custom headers you can use the `Header:Value` notation:
|
||||
To set custom headers you can use the `Header:Value` notation:
|
||||
```shell
|
||||
$ http pie.dev/headers User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' \
|
||||
X-Foo:Bar Referer:https://httpie.org/
|
||||
|
@ -146,24 +146,24 @@ Host: <taken-from-URL>
|
|||
All of these can be overwritten or unset.
|
||||
|
||||
#### Reading headers from a file
|
||||
You can read headers from a file by using the `:@` operator. This would also effectively strip the newlines from the end.
|
||||
You can read headers from a file by using the `:@` operator. This would also effectively strip the newlines from the end.
|
||||
|
||||
```shell
|
||||
$ http pie.dev/headers X-Data:@files/text.txt
|
||||
```
|
||||
|
||||
#### Empty headers and header un-setting
|
||||
To unset a previously specified header (such a one of the default headers), use `Header:`:
|
||||
To unset a previously specified header (such a one of the default headers), use `Header:`:
|
||||
```shell
|
||||
$ http pie.dev/headers Accept: User-Agent:
|
||||
```
|
||||
|
||||
To send a header with an empty value, use `Header;`, with a semicolon:
|
||||
To send a header with an empty value, use `Header;`, with a semicolon:
|
||||
```shell
|
||||
$ http pie.dev/headers 'Header;'
|
||||
```
|
||||
|
||||
Please note that some internal headers, such as `Content-Length`, can’t be unset if they are automatically added by the client itself.
|
||||
Please note that some internal headers, such as `Content-Length`, can’t be unset if they are automatically added by the client itself.
|
||||
|
||||
#### Multiple header values with the same name
|
||||
If the request is sent with multiple headers that are sharing the same name, then the HTTPie will send them individually.
|
||||
|
@ -190,7 +190,7 @@ Numbers: one,two
|
|||
Also be aware that if the current session contains any headers they will get overwritten by individual commands when sending a request instead of being joined together.
|
||||
|
||||
### Offline mode
|
||||
Use `--offline` to construct [HTTP](../../internet/HTTP.md) requests without sending them anywhere. With `--offline`, HTTPie builds a request based on the specified options and arguments, prints it to `stdout`, and then exits. It works completely offline; no network connection is ever made. This has a number of use cases, including:
|
||||
Use `--offline` to construct [HTTP](../../internet/HTTP.md) requests without sending them anywhere. With `--offline`, HTTPie builds a request based on the specified options and arguments, prints it to `stdout`, and then exits. It works completely offline; no network connection is ever made. This has a number of use cases, including:
|
||||
|
||||
Generating API documentation examples that you can copy & paste without sending a request:
|
||||
```shell
|
||||
|
@ -210,10 +210,10 @@ $ http --offline POST pie.dev/post hello=world > request.http
|
|||
$ nc pie.dev 80 < request.http
|
||||
```
|
||||
|
||||
You can also use the `--offline` mode for debugging and exploring [HTTP](../../internet/HTTP.md) and HTTPie, and for “dry runs”.
|
||||
You can also use the `--offline` mode for debugging and exploring [HTTP](../../internet/HTTP.md) and HTTPie, and for “dry runs”.
|
||||
|
||||
### Cookies
|
||||
[HTTP](../../internet/HTTP.md) clients send [cookies](../../internet/Cookie.md) to the server as regular [HTTP](../../internet/HTTP.md) headers. That means, HTTPie does not offer any special syntax for specifying cookies — the usual `Header:Value` notation is used:
|
||||
[HTTP](../../internet/HTTP.md) clients send [cookies](../../internet/Cookie.md) to the server as regular [HTTP](../../internet/HTTP.md) headers. That means, HTTPie does not offer any special syntax for specifying cookies — the usual `Header:Value` notation is used:
|
||||
|
||||
Send a single [cookie](../../internet/Cookie.md):
|
||||
```shell
|
||||
|
@ -230,7 +230,7 @@ Host: pie.dev
|
|||
User-Agent: HTTPie/0.9.9
|
||||
```
|
||||
|
||||
Send multiple cookies (note: the header is quoted to prevent the [shell](../cli/Shell.md) from interpreting the `;`):
|
||||
Send multiple cookies (note: the header is quoted to prevent the [shell](../cli/Shell.md) from interpreting the `;`):
|
||||
|
||||
```shell
|
||||
$ http pie.dev/cookies 'Cookie:sessionid=foo;another-cookie=bar'
|
||||
|
@ -263,7 +263,7 @@ https -A bearer -a token pie.dev/bearer
|
|||
```
|
||||
|
||||
#### Password prompt
|
||||
If you omit the password part of `--auth, -a`, HTTPie securely prompts you for it:
|
||||
If you omit the password part of `--auth, -a`, HTTPie securely prompts you for it:
|
||||
|
||||
```shell
|
||||
$ http -a username pie.dev/basic-auth/username/password
|
||||
|
@ -275,30 +275,30 @@ By default, [HTTP](../../internet/HTTP.md) redirects are not followed and only t
|
|||
$ http pie.dev/redirect/3
|
||||
```
|
||||
|
||||
#### Follow `Location`
|
||||
To instruct HTTPie to follow the `Location` header of `30x` responses and show the final response instead, use the `--follow, -F` option:
|
||||
#### Follow `Location`
|
||||
To instruct HTTPie to follow the `Location` header of `30x` responses and show the final response instead, use the `--follow, -F` option:
|
||||
```shell
|
||||
$ http --follow pie.dev/redirect/3
|
||||
```
|
||||
|
||||
With `307 Temporary Redirect` and `308 Permanent Redirect`, the method and the body of the original request are reused to perform the redirected request. Otherwise, a body-less `GET` request is performed.
|
||||
With `307 Temporary Redirect` and `308 Permanent Redirect`, the method and the body of the original request are reused to perform the redirected request. Otherwise, a body-less `GET` request is performed.
|
||||
|
||||
#### Showing intermediary redirect responses
|
||||
If you wish to see the intermediary requests/responses, then use the `--all` option:
|
||||
If you wish to see the intermediary requests/responses, then use the `--all` option:
|
||||
|
||||
```shell
|
||||
$ http --follow --all pie.dev/redirect/3
|
||||
```
|
||||
|
||||
#### Limiting maximum redirects followed
|
||||
To change the default limit of maximum `30` redirects, use the `--max-redirects=<limit>` option:
|
||||
To change the default limit of maximum `30` redirects, use the `--max-redirects=<limit>` option:
|
||||
|
||||
```shell
|
||||
$ http --follow --all --max-redirects=2 pie.dev/redirect/3
|
||||
```
|
||||
|
||||
### Proxies
|
||||
You can specify proxies to be used through the `--proxy` argument for each protocol (which is included in the value in case of redirects across protocols):
|
||||
You can specify proxies to be used through the `--proxy` argument for each protocol (which is included in the value in case of redirects across protocols):
|
||||
```shell
|
||||
$ http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org
|
||||
```
|
||||
|
@ -309,9 +309,9 @@ $ http --proxy=http:http://user:pass@10.10.1.10:3128 example.org
|
|||
```
|
||||
|
||||
#### Environment variables
|
||||
You can also configure proxies by [environment variables](../../linux/Environment%20Variables.md) `ALL_PROXY`, `HTTP_PROXY` and `HTTPS_PROXY`, and the underlying [Requests library](https://requests.readthedocs.io/en/latest/) will pick them up. If you want to disable proxies configured through the [environment variables](../../linux/Environment%20Variables.md) for certain hosts, you can specify them in `NO_PROXY`.
|
||||
You can also configure proxies by [environment variables](../../linux/Environment%20Variables.md) `ALL_PROXY`, `HTTP_PROXY` and `HTTPS_PROXY`, and the underlying [Requests library](https://requests.readthedocs.io/en/latest/) will pick them up. If you want to disable proxies configured through the [environment variables](../../linux/Environment%20Variables.md) for certain hosts, you can specify them in `NO_PROXY`.
|
||||
|
||||
In your `~/.bash_profile`:
|
||||
In your `~/.bash_profile`:
|
||||
```shell
|
||||
export HTTP_PROXY=http://10.10.1.10:3128
|
||||
export HTTPS_PROXY=https://10.10.1.10:1080
|
||||
|
@ -319,13 +319,13 @@ export NO_PROXY=localhost,example.com
|
|||
```
|
||||
|
||||
#### SOCK
|
||||
Usage for SOCKS is the same as for other types of proxies:
|
||||
Usage for SOCKS is the same as for other types of proxies:
|
||||
```shell
|
||||
$ http --proxy=http:socks5://user:pass@host:port --proxy=https:socks5://user:pass@host:port example.org
|
||||
```
|
||||
|
||||
### HTTPS
|
||||
To skip the host’s SSL certificate verification, you can pass `--verify=no` (default is `yes`):
|
||||
To skip the host’s SSL certificate verification, you can pass `--verify=no` (default is `yes`):
|
||||
|
||||
```shell
|
||||
$ http --verify=no https://pie.dev/get
|
||||
|
@ -338,16 +338,16 @@ By default, HTTPie only outputs the final response and the whole response messag
|
|||
| --------------------------:| -------------------------------------------------------------------------------------------------- |
|
||||
| `--headers, -h` | Only the response headers are printed |
|
||||
| `--body, -b` | Only the response body is printed |
|
||||
| `--meta, -m` | Only the response metadata is printed |
|
||||
| `--verbose, -v` | Print the whole [HTTP](../../internet/HTTP.md) exchange (request and response). This option also enables `--all` (see below) |
|
||||
| `--verbose --verbose, -vv` | Just like `-v`, but also include the response metadata. |
|
||||
| `--meta, -m` | Only the response metadata is printed |
|
||||
| `--verbose, -v` | Print the whole [HTTP](../../internet/HTTP.md) exchange (request and response). This option also enables `--all` (see below) |
|
||||
| `--verbose --verbose, -vv` | Just like `-v`, but also include the response metadata. |
|
||||
| `--print, -p` | Selects parts of the [HTTP](../../internet/HTTP.md) exchange |
|
||||
| `--quiet, -q` | Don’t print anything to `stdout` and `stderr` |
|
||||
| `--quiet, -q` | Don’t print anything to `stdout` and `stderr` |
|
||||
|
||||
### Download mode
|
||||
HTTPie features a download mode in which it acts similarly to [wget](../cli/network/wget.md).
|
||||
HTTPie features a download mode in which it acts similarly to [wget](../cli/network/wget.md).
|
||||
|
||||
When enabled using the `--download, -d` flag, response headers are printed to the terminal (`stderr`), and a progress bar is shown while the response body is being saved to a file.
|
||||
When enabled using the `--download, -d` flag, response headers are printed to the terminal (`stderr`), and a progress bar is shown while the response body is being saved to a file.
|
||||
```shell
|
||||
$ http --download https://github.com/httpie/cli/archive/master.tar.gz
|
||||
```
|
||||
|
@ -365,11 +365,11 @@ Done. 251.30 kB in 2.73862s (91.76 kB/s)
|
|||
#### Downloaded filename
|
||||
There are three mutually exclusive ways through which HTTPie determines the output filename (with decreasing priority):
|
||||
|
||||
1. You can explicitly provide it via `--output, -o`. The file gets overwritten if it already exists (or appended to with `--continue, -c`).
|
||||
2. The server may specify the filename in the optional `Content-Disposition` response header. Any leading dots are stripped from a server-provided filename.
|
||||
3. The last resort HTTPie uses is to generate the filename from a combination of the request [URL](../../internet/URL.md) and the response `Content-Type`. The initial [URL](../../internet/URL.md) is always used as the basis for the generated filename — even if there has been one or more redirects.
|
||||
1. You can explicitly provide it via `--output, -o`. The file gets overwritten if it already exists (or appended to with `--continue, -c`).
|
||||
2. The server may specify the filename in the optional `Content-Disposition` response header. Any leading dots are stripped from a server-provided filename.
|
||||
3. The last resort HTTPie uses is to generate the filename from a combination of the request [URL](../../internet/URL.md) and the response `Content-Type`. The initial [URL](../../internet/URL.md) is always used as the basis for the generated filename — even if there has been one or more redirects.
|
||||
|
||||
To prevent data loss by overwriting, HTTPie adds a unique numerical suffix to the filename when necessary (unless specified with `--output, -o`).
|
||||
To prevent data loss by overwriting, HTTPie adds a unique numerical suffix to the filename when necessary (unless specified with `--output, -o`).
|
||||
|
||||
#### Piping while downloading
|
||||
You can also redirect the response body to another program while the response headers and progress are still shown in the terminal:
|
||||
|
@ -379,17 +379,17 @@ $ http -d https://github.com/httpie/cli/archive/master.tar.gz | tar zxf -
|
|||
```
|
||||
|
||||
#### Resuming downloads
|
||||
If `--output, -o` is specified, you can resume a partial download using the `--continue, -c` option. This only works with servers that support `Range` requests and `206 Partial Content` responses. If the server doesn’t support that, the whole file will simply be downloaded:
|
||||
If `--output, -o` is specified, you can resume a partial download using the `--continue, -c` option. This only works with servers that support `Range` requests and `206 Partial Content` responses. If the server doesn’t support that, the whole file will simply be downloaded:
|
||||
```shell
|
||||
$ http -dco file.zip example.org/file
|
||||
```
|
||||
|
||||
`-dco` is shorthand for `--download` `--continue` `--output`.
|
||||
`-dco` is shorthand for `--download` `--continue` `--output`.
|
||||
|
||||
### Sessions
|
||||
By default, every request HTTPie makes is completely independent of any previous ones to the same host.
|
||||
|
||||
However, HTTPie also supports persistent sessions via the `--session=SESSION_NAME_OR_PATH` option. In a session, custom [HTTP](../../internet/HTTP.md) headers (except for the ones starting with `Content-` or `If-`), authentication, and cookies (manually specified or sent by the server) persist between requests to the same host.
|
||||
However, HTTPie also supports persistent sessions via the `--session=SESSION_NAME_OR_PATH` option. In a session, custom [HTTP](../../internet/HTTP.md) headers (except for the ones starting with `Content-` or `If-`), authentication, and cookies (manually specified or sent by the server) persist between requests to the same host.
|
||||
|
||||
```shell
|
||||
# Create a new session:
|
||||
|
@ -405,7 +405,7 @@ $ http --session=./session.json pie.dev/headers
|
|||
All session data, including credentials, prompted passwords, [cookie](../../internet/Cookie.md) data, and custom headers are stored in plain text. That means session files can also be created and edited manually in a text editor—they are regular [JSON](../../files/JSON.md). It also means that they can be read by anyone who has access to the session file.
|
||||
|
||||
#### Readonly session
|
||||
To use the original session file without updating it from the request/response exchange after it has been created, specify the session name via `--session-read-only=SESSION_NAME_OR_PATH` instead.
|
||||
To use the original session file without updating it from the request/response exchange after it has been created, specify the session name via `--session-read-only=SESSION_NAME_OR_PATH` instead.
|
||||
```shell
|
||||
# If the session file doesn’t exist, then it is created:
|
||||
$ http --session-read-only=./ro-session.json pie.dev/headers Custom-Header:orig-value
|
||||
|
|
|
@ -227,57 +227,57 @@ Usage: `cargo update [--dry-run]`
|
|||
The `Cargo.toml` file for each package is called its manifest. It is written in the [TOML](../../files/TOML.md) format. It contains metadata that is needed to compile the package.
|
||||
|
||||
Every manifest file consists of the following sections:
|
||||
- [`cargo-features`](https://doc.rust-lang.org/cargo/reference/unstable.html) — Unstable, nightly-only features.
|
||||
- [`[package]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-package-section) — Defines a package.
|
||||
- [`name`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field) — The name of the package.
|
||||
- [`version`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field) — The version of the package.
|
||||
- [`authors`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field) — The authors of the package.
|
||||
- [`edition`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-edition-field) — The [Rust](../../dev/programming/languages/Rust.md) edition.
|
||||
- [`rust-version`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) — The minimal supported [Rust](../../dev/programming/languages/Rust.md) version.
|
||||
- [`description`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-description-field) — A description of the package.
|
||||
- [`documentation`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-documentation-field) — [URL](../../internet/URL.md) of the package documentation.
|
||||
- [`readme`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-readme-field) — Path to the package’s README file.
|
||||
- [`homepage`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-homepage-field) — [URL](../../internet/URL.md) of the package homepage.
|
||||
- [`repository`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-repository-field) — [URL](../../internet/URL.md) of the package source repository.
|
||||
- [`license`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) — The package license.
|
||||
- [`license-file`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) — Path to the text of the license.
|
||||
- [`keywords`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-keywords-field) — Keywords for the package.
|
||||
- [`categories`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-categories-field) — Categories of the package.
|
||||
- [`workspace`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-workspace-field) — Path to the workspace for the package.
|
||||
- [`build`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-build-field) — Path to the package build script.
|
||||
- [`links`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-links-field) — Name of the native library the package links with.
|
||||
- [`exclude`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) — Files to exclude when publishing.
|
||||
- [`include`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) — Files to include when publishing.
|
||||
- [`publish`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field) — Can be used to prevent publishing the package.
|
||||
- [`metadata`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table) — Extra settings for external tools.
|
||||
- [`default-run`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-default-run-field) — The default binary to run by [`cargo run`](https://doc.rust-lang.org/cargo/commands/cargo-run.html).
|
||||
- [`autobins`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables binary auto discovery.
|
||||
- [`autoexamples`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables example auto discovery.
|
||||
- [`autotests`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables test auto discovery.
|
||||
- [`autobenches`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables bench auto discovery.
|
||||
- [`resolver`](https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions) — Sets the dependency resolver to use.
|
||||
- Target tables: (see [configuration](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target) for settings)
|
||||
- [`[lib]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#library) — Library target settings.
|
||||
- [`[[bin]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries) — Binary target settings.
|
||||
- [`[[example]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#examples) — Example target settings.
|
||||
- [`[[test]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#tests) — Test target settings.
|
||||
- [`[[bench]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#benchmarks) — Benchmark target settings.
|
||||
- [`cargo-features`](https://doc.rust-lang.org/cargo/reference/unstable.html) — Unstable, nightly-only features.
|
||||
- [`[package]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-package-section) — Defines a package.
|
||||
- [`name`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field) — The name of the package.
|
||||
- [`version`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field) — The version of the package.
|
||||
- [`authors`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field) — The authors of the package.
|
||||
- [`edition`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-edition-field) — The [Rust](../../dev/programming/languages/Rust.md) edition.
|
||||
- [`rust-version`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) — The minimal supported [Rust](../../dev/programming/languages/Rust.md) version.
|
||||
- [`description`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-description-field) — A description of the package.
|
||||
- [`documentation`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-documentation-field) — [URL](../../internet/URL.md) of the package documentation.
|
||||
- [`readme`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-readme-field) — Path to the package’s README file.
|
||||
- [`homepage`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-homepage-field) — [URL](../../internet/URL.md) of the package homepage.
|
||||
- [`repository`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-repository-field) — [URL](../../internet/URL.md) of the package source repository.
|
||||
- [`license`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) — The package license.
|
||||
- [`license-file`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) — Path to the text of the license.
|
||||
- [`keywords`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-keywords-field) — Keywords for the package.
|
||||
- [`categories`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-categories-field) — Categories of the package.
|
||||
- [`workspace`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-workspace-field) — Path to the workspace for the package.
|
||||
- [`build`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-build-field) — Path to the package build script.
|
||||
- [`links`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-links-field) — Name of the native library the package links with.
|
||||
- [`exclude`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) — Files to exclude when publishing.
|
||||
- [`include`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) — Files to include when publishing.
|
||||
- [`publish`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field) — Can be used to prevent publishing the package.
|
||||
- [`metadata`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table) — Extra settings for external tools.
|
||||
- [`default-run`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-default-run-field) — The default binary to run by [`cargo run`](https://doc.rust-lang.org/cargo/commands/cargo-run.html).
|
||||
- [`autobins`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables binary auto discovery.
|
||||
- [`autoexamples`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables example auto discovery.
|
||||
- [`autotests`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables test auto discovery.
|
||||
- [`autobenches`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery) — Disables bench auto discovery.
|
||||
- [`resolver`](https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions) — Sets the dependency resolver to use.
|
||||
- Target tables: (see [configuration](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target) for settings)
|
||||
- [`[lib]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#library) — Library target settings.
|
||||
- [`[[bin]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries) — Binary target settings.
|
||||
- [`[[example]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#examples) — Example target settings.
|
||||
- [`[[test]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#tests) — Test target settings.
|
||||
- [`[[bench]]`](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#benchmarks) — Benchmark target settings.
|
||||
- Dependency tables:
|
||||
- [`[dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html) — Package library dependencies.
|
||||
- [`[dev-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies) — Dependencies for examples, tests, and benchmarks.
|
||||
- [`[build-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#build-dependencies) — Dependencies for build scripts.
|
||||
- [`[target]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) — Platform-specific dependencies.
|
||||
- [`[badges]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section) — Badges to display on a registry.
|
||||
- [`[features]`](https://doc.rust-lang.org/cargo/reference/features.html) — Conditional compilation features.
|
||||
- [`[lints]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-lints-section) — Configure linters for this package.
|
||||
- [`[patch]`](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section) — Override dependencies.
|
||||
- [`[profile]`](https://doc.rust-lang.org/cargo/reference/profiles.html) — Compiler settings and optimizations.
|
||||
- [`[workspace]`](https://doc.rust-lang.org/cargo/reference/workspaces.html) — The workspace definition.
|
||||
- [`[dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html) — Package library dependencies.
|
||||
- [`[dev-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies) — Dependencies for examples, tests, and benchmarks.
|
||||
- [`[build-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#build-dependencies) — Dependencies for build scripts.
|
||||
- [`[target]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) — Platform-specific dependencies.
|
||||
- [`[badges]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section) — Badges to display on a registry.
|
||||
- [`[features]`](https://doc.rust-lang.org/cargo/reference/features.html) — Conditional compilation features.
|
||||
- [`[lints]`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-lints-section) — Configure linters for this package.
|
||||
- [`[patch]`](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section) — Override dependencies.
|
||||
- [`[profile]`](https://doc.rust-lang.org/cargo/reference/profiles.html) — Compiler settings and optimizations.
|
||||
- [`[workspace]`](https://doc.rust-lang.org/cargo/reference/workspaces.html) — The workspace definition.
|
||||
|
||||
## Build Scripts
|
||||
Some packages need to compile third-party non-[Rust](../../dev/programming/languages/Rust.md) code, for example C libraries. Other packages need to link to C libraries which can either be located on the system or possibly need to be built from source. Others still need facilities for functionality such as code generation before building (think parser generators).
|
||||
|
||||
Cargo does not aim to replace other tools that are well-optimized for these tasks, but it does integrate with them with custom build scripts. Placing a file named `build.rs` in the root of a package will cause Cargo to compile that script and execute it just before building the package.
|
||||
Cargo does not aim to replace other tools that are well-optimized for these tasks, but it does integrate with them with custom build scripts. Placing a file named `build.rs` in the root of a package will cause Cargo to compile that script and execute it just before building the package.
|
||||
|
||||
```rust
|
||||
// Example custom build script.
|
||||
|
@ -292,35 +292,35 @@ fn main() {
|
|||
```
|
||||
|
||||
## Environment Variables
|
||||
When the build script is run, there are a number of inputs to the build script, all passed in the form of [environment variables](../../linux/Environment%20Variables.md).
|
||||
When the build script is run, there are a number of inputs to the build script, all passed in the form of [environment variables](../../linux/Environment%20Variables.md).
|
||||
|
||||
Cargo exposes these [environment variables](../../linux/Environment%20Variables.md) to your crate when it is compiled. Note that this applies for running binaries with `cargo run` and `cargo test` as well. To get the value of any of these variables in a [Rust](../../dev/programming/languages/Rust.md) program, do this:
|
||||
Cargo exposes these [environment variables](../../linux/Environment%20Variables.md) to your crate when it is compiled. Note that this applies for running binaries with `cargo run` and `cargo test` as well. To get the value of any of these variables in a [Rust](../../dev/programming/languages/Rust.md) program, do this:
|
||||
|
||||
```rust
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
```
|
||||
|
||||
Exposed environment variables:
|
||||
- `CARGO` — Path to the `cargo` binary performing the build.
|
||||
- `CARGO_MANIFEST_DIR` — The directory containing the manifest of your package.
|
||||
- `CARGO_PKG_VERSION` — The full version of your package.
|
||||
- `CARGO_PKG_VERSION_MAJOR` — The major version of your package.
|
||||
- `CARGO_PKG_VERSION_MINOR` — The minor version of your package.
|
||||
- `CARGO_PKG_VERSION_PATCH` — The patch version of your package.
|
||||
- `CARGO_PKG_VERSION_PRE` — The pre-release version of your package.
|
||||
- `CARGO_PKG_AUTHORS` — Colon separated list of authors from the manifest of your package.
|
||||
- `CARGO_PKG_NAME` — The name of your package.
|
||||
- `CARGO_PKG_DESCRIPTION` — The description from the manifest of your package.
|
||||
- `CARGO_PKG_HOMEPAGE` — The home page from the manifest of your package.
|
||||
- `CARGO_PKG_REPOSITORY` — The repository from the manifest of your package.
|
||||
- `CARGO_PKG_LICENSE` — The license from the manifest of your package.
|
||||
- `CARGO_PKG_LICENSE_FILE` — The license file from the manifest of your package.
|
||||
- `CARGO_PKG_RUST_VERSION` — The [Rust](../../dev/programming/languages/Rust.md) version from the manifest of your package. Note that this is the minimum [Rust](../../dev/programming/languages/Rust.md) version supported by the package, not the current [Rust](../../dev/programming/languages/Rust.md) version.
|
||||
- `CARGO_PKG_README` — Path to the README file of your package.
|
||||
- `CARGO_CRATE_NAME` — The name of the crate that is currently being compiled. It is the name of the Cargo target with `-` converted to `_`, such as the name of the library, binary, example, integration test, or benchmark.
|
||||
- `CARGO_BIN_NAME` — The name of the binary that is currently being compiled. Only set for binaries or binary examples. This name does not include any file extension, such as `.exe`.
|
||||
- `OUT_DIR` — If the package has a build script, this is set to the folder where the build script should place its output.
|
||||
- `CARGO_BIN_EXE_<name>` — The absolute path to a binary target’s executable. This is only set when building an integration test or benchmark. This may be used with the `env` macro to find the executable to run for testing purposes. The `<name>` is the name of the binary target, exactly as-is. For example, `CARGO_BIN_EXE_my-program` for a binary named `my-program`. Binaries are automatically built when the test is built, unless the binary has required features that are not enabled.
|
||||
- `CARGO_PRIMARY_PACKAGE` — This environment variable will be set if the package being built is primary. Primary packages are the ones the user selected on the command-line, either with `-p` flags or the defaults based on the current directory and the default workspace members. This environment variable will not be set when building dependencies. This is only set when compiling the package (not when running binaries or tests).
|
||||
- `CARGO_TARGET_TMPDIR` — Only set when building integration test or benchmark code. This is a path to a directory inside the target directory where integration tests or benchmarks are free to put any data needed by the tests/benches. Cargo initially creates this directory but doesn’t manage its content in any way, this is the responsibility of the test code.
|
||||
- `CARGO` — Path to the `cargo` binary performing the build.
|
||||
- `CARGO_MANIFEST_DIR` — The directory containing the manifest of your package.
|
||||
- `CARGO_PKG_VERSION` — The full version of your package.
|
||||
- `CARGO_PKG_VERSION_MAJOR` — The major version of your package.
|
||||
- `CARGO_PKG_VERSION_MINOR` — The minor version of your package.
|
||||
- `CARGO_PKG_VERSION_PATCH` — The patch version of your package.
|
||||
- `CARGO_PKG_VERSION_PRE` — The pre-release version of your package.
|
||||
- `CARGO_PKG_AUTHORS` — Colon separated list of authors from the manifest of your package.
|
||||
- `CARGO_PKG_NAME` — The name of your package.
|
||||
- `CARGO_PKG_DESCRIPTION` — The description from the manifest of your package.
|
||||
- `CARGO_PKG_HOMEPAGE` — The home page from the manifest of your package.
|
||||
- `CARGO_PKG_REPOSITORY` — The repository from the manifest of your package.
|
||||
- `CARGO_PKG_LICENSE` — The license from the manifest of your package.
|
||||
- `CARGO_PKG_LICENSE_FILE` — The license file from the manifest of your package.
|
||||
- `CARGO_PKG_RUST_VERSION` — The [Rust](../../dev/programming/languages/Rust.md) version from the manifest of your package. Note that this is the minimum [Rust](../../dev/programming/languages/Rust.md) version supported by the package, not the current [Rust](../../dev/programming/languages/Rust.md) version.
|
||||
- `CARGO_PKG_README` — Path to the README file of your package.
|
||||
- `CARGO_CRATE_NAME` — The name of the crate that is currently being compiled. It is the name of the Cargo target with `-` converted to `_`, such as the name of the library, binary, example, integration test, or benchmark.
|
||||
- `CARGO_BIN_NAME` — The name of the binary that is currently being compiled. Only set for binaries or binary examples. This name does not include any file extension, such as `.exe`.
|
||||
- `OUT_DIR` — If the package has a build script, this is set to the folder where the build script should place its output.
|
||||
- `CARGO_BIN_EXE_<name>` — The absolute path to a binary target’s executable. This is only set when building an integration test or benchmark. This may be used with the `env` macro to find the executable to run for testing purposes. The `<name>` is the name of the binary target, exactly as-is. For example, `CARGO_BIN_EXE_my-program` for a binary named `my-program`. Binaries are automatically built when the test is built, unless the binary has required features that are not enabled.
|
||||
- `CARGO_PRIMARY_PACKAGE` — This environment variable will be set if the package being built is primary. Primary packages are the ones the user selected on the command-line, either with `-p` flags or the defaults based on the current directory and the default workspace members. This environment variable will not be set when building dependencies. This is only set when compiling the package (not when running binaries or tests).
|
||||
- `CARGO_TARGET_TMPDIR` — Only set when building integration test or benchmark code. This is a path to a directory inside the target directory where integration tests or benchmarks are free to put any data needed by the tests/benches. Cargo initially creates this directory but doesn’t manage its content in any way, this is the responsibility of the test code.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue