hurl/docs/manual/hurlfmt.md

145 lines
1.9 KiB
Markdown
Raw Normal View History

2020-08-27 10:07:46 +03:00
## NAME
hurlfmt - format Hurl files
## SYNOPSIS
2023-06-28 17:14:06 +03:00
**hurlfmt** [options] [FILE...]
2020-08-27 10:07:46 +03:00
## DESCRIPTION
2023-05-03 14:34:40 +03:00
**hurlfmt** formats Hurl files and converts them from/to other formats.
2020-11-15 11:51:01 +03:00
With no FILE, read standard input.
By default, hurlfmt outputs a formatted and colorized version of the input hurl file.
```
$ hurl hello.hurl
GET http://localhost:8000/hello
HTTP/1.0 200
```
hurlfmt can be used to convert to other format.
```
$ hurl hello.hurl --output json | jq
{
"entries": [
{
"request": {
"method": "GET",
"url": "http://localhost:8000/hello"
},
"response": {
"version": "HTTP/1.0",
"status": 200
}
}
]
}
```
2020-08-27 10:07:46 +03:00
2023-05-03 14:34:40 +03:00
hurlfmt can also be used to convert a curl command-line to Hurl
```
$ echo "curl http://localhost:8000/custom-headers -H 'Fruit:Raspberry'" | hurlfmt --in curl
GET http://localhost:8000/custom-headers
Fruit: Raspberry
```
2020-08-27 10:07:46 +03:00
## OPTIONS
2020-11-15 11:51:01 +03:00
### --check {#check}
Run in 'check' mode. Exits with 0 if input is formatted correctly, 1 otherwise.
This can not be used with [--output](#output).
This option is not stable yet.
2020-08-27 10:07:46 +03:00
### --color {#color}
2020-11-15 11:51:01 +03:00
Colorize Output.
This can not be used [--in-place](#inplace).
2020-08-27 10:07:46 +03:00
### -h, --help {#help}
2020-11-15 11:51:01 +03:00
Usage help.
2020-08-27 10:07:46 +03:00
2023-05-03 14:34:40 +03:00
### --in {#input-format}
Specify input format: hurl (default) or curl
2020-08-27 10:07:46 +03:00
2020-11-15 11:51:01 +03:00
### --inplace {#inplace}
2020-08-27 10:07:46 +03:00
2020-11-15 11:51:01 +03:00
Modify file in place.
2020-08-27 10:07:46 +03:00
2020-11-15 11:51:01 +03:00
This can be used only with text output.
2020-08-27 10:07:46 +03:00
2020-11-15 11:51:01 +03:00
### --no-color {#nocolor}
Do not colorize Output.
2023-05-03 14:34:40 +03:00
### --out {#output-format}
2020-11-15 11:51:01 +03:00
2023-05-03 14:34:40 +03:00
Specify output format: hurl (default), json or html
2020-11-15 11:51:01 +03:00
2020-11-17 00:12:43 +03:00
### -o, --output <file> {#output}
2020-11-15 11:51:01 +03:00
2020-11-17 00:12:43 +03:00
Write output to <file> instead of stdout.
2020-11-15 11:51:01 +03:00
### --standalone {#standalone}
Output full html file with css instead of html fragment (default).
This can be used only with html output.
2020-08-27 10:07:46 +03:00
### -V, --version {#version}
Prints version information
## EXIT CODES
### 1
2020-11-15 11:51:01 +03:00
2020-08-27 10:07:46 +03:00
Failed to parse command-line options.
### 2
2020-11-15 11:51:01 +03:00
2020-08-27 10:07:46 +03:00
Input File Parsing Error.
## WWW
[https://hurl.dev](https://hurl.dev)
## SEE ALSO
hurl(1)