Add --no-pretty command line flag.

This commit is contained in:
Jean-Christophe Amiel 2025-08-29 14:47:36 +02:00
parent 1aefabd749
commit 02c8cfbafb
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
16 changed files with 53 additions and 9 deletions

View File

@ -1481,13 +1481,14 @@ will follow a redirection only for the second entry.
| <a href="#netrc-optional" id="netrc-optional"><code>--netrc-optional</code></a> | Similar to [`--netrc`](#netrc), but make the .netrc usage optional.<br><br>See also [`--netrc-file`](#netrc-file).<br> |
| <a href="#no-color" id="no-color"><code>--no-color</code></a> | Do not colorize output.<br><br>This is a cli-only option.<br> |
| <a href="#no-output" id="no-output"><code>--no-output</code></a> | Suppress output. By default, Hurl outputs the body of the last response.<br><br>This is a cli-only option.<br> |
| <a href="#no-pretty" id="no-pretty"><code>--no-pretty</code></a> | Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if<br>standard output is a terminal.<br><br>This is a cli-only option.<br> |
| <a href="#noproxy" id="noproxy"><code>--noproxy &lt;HOST(S)&gt;</code></a> | Comma-separated list of hosts which do not use a proxy.<br><br>Override value from Environment variable no_proxy.<br> |
| <a href="#ntlm" id="ntlm"><code>--ntlm</code></a> | Tell Hurl to use NTLM authentication<br> |
| <a href="#output" id="output"><code>-o, --output &lt;FILE&gt;</code></a> | Write output to FILE instead of stdout. Use '-' for stdout in [Options] sections.<br> |
| <a href="#parallel" id="parallel"><code>--parallel</code></a> | Run files in parallel.<br><br>Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in [`--test`](#test) mode.<br><br>See also [`--jobs`](#jobs).<br><br>This is a cli-only option.<br> |
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
| <a href="#pinnedpubkey" id="pinnedpubkey"><code>--pinnedpubkey &lt;HASHES&gt;</code></a> | When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, Hurl aborts the connection before sending or receiving any data.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#progress-bar" id="progress-bar"><code>--progress-bar</code></a> | Display a progress bar in test mode. The progress bar is displayed only in interactive TTYs. This option forces the progress bar to be displayed even in non-interactive TTYs.<br><br>This is a cli-only option.<br> |
| <a href="#proxy" id="proxy"><code>-x, --proxy &lt;[PROTOCOL://]HOST[:PORT]&gt;</code></a> | Use the specified proxy.<br> |
| <a href="#repeat" id="repeat"><code>--repeat &lt;NUM&gt;</code></a> | Repeat the input files sequence NUM times, -1 for infinite loop. Given a.hurl, b.hurl, c.hurl as input, repeat two<br>times will run a.hurl, b.hurl, c.hurl, a.hurl, b.hurl, c.hurl.<br> |

View File

@ -57,6 +57,7 @@ _hurl() {
'--netrc-optional[Use either .netrc or the URL]' \
'--no-color[Do not colorize output]' \
'--no-output[Suppress output. By default, Hurl outputs the body of the last response]' \
'--no-pretty[Do not prettify response output]' \
'--noproxy[List of hosts which do not use proxy]: :' \
'--ntlm[Tell Hurl to use NTLM authentication]' \
'(-o --output)'{-o,--output}'[Write to FILE instead of stdout]: :_files' \

View File

@ -62,6 +62,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
[CompletionResult]::new('--netrc-optional', 'netrc-optional', [CompletionResultType]::ParameterName, 'Use either .netrc or the URL')
[CompletionResult]::new('--no-color', 'no-color', [CompletionResultType]::ParameterName, 'Do not colorize output')
[CompletionResult]::new('--no-output', 'no-output', [CompletionResultType]::ParameterName, 'Suppress output. By default, Hurl outputs the body of the last response')
[CompletionResult]::new('--no-pretty', 'no-pretty', [CompletionResultType]::ParameterName, 'Do not prettify response output')
[CompletionResult]::new('--noproxy', 'noproxy', [CompletionResultType]::ParameterName, 'List of hosts which do not use proxy')
[CompletionResult]::new('--ntlm', 'ntlm', [CompletionResultType]::ParameterName, 'Tell Hurl to use NTLM authentication')
[CompletionResult]::new('--output', 'output', [CompletionResultType]::ParameterName, 'Write to FILE instead of stdout')

View File

@ -4,7 +4,7 @@ _hurl()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ $cur == -* ]]; then
COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --curl --delay --error-format --file-root --location --location-trusted --from-entry --glob --header --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --jobs --json --limit-rate --max-filesize --max-redirs --max-time --negotiate --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --ntlm --output --parallel --path-as-is --pinnedpubkey --pretty --progress-bar --proxy --repeat --report-html --report-json --report-junit --report-tap --resolve --retry --retry-interval --secret --secrets-file --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --curl --delay --error-format --file-root --location --location-trusted --from-entry --glob --header --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --jobs --json --limit-rate --max-filesize --max-redirs --max-time --negotiate --netrc --netrc-file --netrc-optional --no-color --no-output --no-pretty --noproxy --ntlm --output --parallel --path-as-is --pinnedpubkey --pretty --progress-bar --proxy --repeat --report-html --report-json --report-junit --report-tap --resolve --retry --retry-interval --secret --secrets-file --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
return
fi
# Generate filenames by default

View File

@ -40,6 +40,7 @@ complete -c hurl -l netrc-file -d 'Specify FILE for .netrc'
complete -c hurl -l netrc-optional -d 'Use either .netrc or the URL'
complete -c hurl -l no-color -d 'Do not colorize output'
complete -c hurl -l no-output -d 'Suppress output. By default, Hurl outputs the body of the last response'
complete -c hurl -l no-pretty -d 'Do not prettify response output'
complete -c hurl -l noproxy -d 'List of hosts which do not use proxy'
complete -c hurl -l ntlm -d 'Tell Hurl to use NTLM authentication'
complete -c hurl -l output -d 'Write to FILE instead of stdout'

View File

@ -190,13 +190,14 @@ will follow a redirection only for the second entry.
| <a href="#netrc-optional" id="netrc-optional"><code>--netrc-optional</code></a> | Similar to [`--netrc`](#netrc), but make the .netrc usage optional.<br><br>See also [`--netrc-file`](#netrc-file).<br> |
| <a href="#no-color" id="no-color"><code>--no-color</code></a> | Do not colorize output.<br><br>This is a cli-only option.<br> |
| <a href="#no-output" id="no-output"><code>--no-output</code></a> | Suppress output. By default, Hurl outputs the body of the last response.<br><br>This is a cli-only option.<br> |
| <a href="#no-pretty" id="no-pretty"><code>--no-pretty</code></a> | Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if<br>standard output is a terminal.<br><br>This is a cli-only option.<br> |
| <a href="#noproxy" id="noproxy"><code>--noproxy &lt;HOST(S)&gt;</code></a> | Comma-separated list of hosts which do not use a proxy.<br><br>Override value from Environment variable no_proxy.<br> |
| <a href="#ntlm" id="ntlm"><code>--ntlm</code></a> | Tell Hurl to use NTLM authentication<br> |
| <a href="#output" id="output"><code>-o, --output &lt;FILE&gt;</code></a> | Write output to FILE instead of stdout. Use '-' for stdout in [Options] sections.<br> |
| <a href="#parallel" id="parallel"><code>--parallel</code></a> | Run files in parallel.<br><br>Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in [`--test`](#test) mode.<br><br>See also [`--jobs`](#jobs).<br><br>This is a cli-only option.<br> |
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
| <a href="#pinnedpubkey" id="pinnedpubkey"><code>--pinnedpubkey &lt;HASHES&gt;</code></a> | When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, Hurl aborts the connection before sending or receiving any data.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#progress-bar" id="progress-bar"><code>--progress-bar</code></a> | Display a progress bar in test mode. The progress bar is displayed only in interactive TTYs. This option forces the progress bar to be displayed even in non-interactive TTYs.<br><br>This is a cli-only option.<br> |
| <a href="#proxy" id="proxy"><code>-x, --proxy &lt;[PROTOCOL://]HOST[:PORT]&gt;</code></a> | Use the specified proxy.<br> |
| <a href="#repeat" id="repeat"><code>--repeat &lt;NUM&gt;</code></a> | Repeat the input files sequence NUM times, -1 for infinite loop. Given a.hurl, b.hurl, c.hurl as input, repeat two<br>times will run a.hurl, b.hurl, c.hurl, a.hurl, b.hurl, c.hurl.<br> |

View File

@ -1,4 +1,4 @@
.TH hurl 1 "27 Aug 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual"
.TH hurl 1 "29 Aug 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual"
.SH NAME
hurl - run and test HTTP requests.
@ -372,6 +372,13 @@ Suppress output. By default, Hurl outputs the body of the last response.
This is a cli-only option.
.IP "--no-pretty "
Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if
standard output is a terminal.
This is a cli-only option.
.IP "--noproxy <HOST(S)> "
Comma-separated list of hosts which do not use a proxy.
@ -406,7 +413,7 @@ When negotiating a TLS or SSL connection, the server sends a certificate indicat
.IP "--pretty "
Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see\fI--no-color\fP to format without color.
Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see\fI--no-color\fP to format without color.
This is a cli-only option.

View File

@ -391,6 +391,13 @@ Suppress output. By default, Hurl outputs the body of the last response.
This is a cli-only option.
### --no-pretty {#no-pretty}
Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if
standard output is a terminal.
This is a cli-only option.
### --noproxy <HOST(S)> {#noproxy}
Comma-separated list of hosts which do not use a proxy.
@ -425,7 +432,7 @@ When negotiating a TLS or SSL connection, the server sends a certificate indicat
### --pretty {#pretty}
Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see[`--no-color`](#no-color) to format without color.
Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see[`--no-color`](#no-color) to format without color.
This is a cli-only option.

View File

@ -1,4 +1,4 @@
.TH hurl 1 "27 Aug 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual"
.TH hurl 1 "29 Aug 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual"
.SH NAME
hurlfmt - format Hurl files

View File

@ -0,0 +1,9 @@
name: no_pretty
long: no-pretty
help: Do not prettify response output
help_heading: Output options
conflict: pretty
cli_only: true
---
Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if
standard output is a terminal.

View File

@ -4,4 +4,4 @@ help: Prettify JSON response output
help_heading: Output options
cli_only: true
---
Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see[`--no-color`](#no-color) to format without color.
Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see[`--no-color`](#no-color) to format without color.

View File

@ -88,7 +88,9 @@ Output options:
--no-color Do not colorize output
--no-output Suppress output. By default, Hurl outputs the body of the last
response
--no-pretty Do not prettify response output
-o, --output <FILE> Write to FILE instead of stdout
--pretty Prettify JSON response output
--progress-bar Display a progress bar in test mode
-v, --verbose Turn on verbose
--very-verbose Turn on verbose output, including HTTP response and libcurl logs

View File

@ -1481,13 +1481,14 @@ will follow a redirection only for the second entry.
| <a href="#netrc-optional" id="netrc-optional"><code>--netrc-optional</code></a> | Similar to [`--netrc`](#netrc), but make the .netrc usage optional.<br><br>See also [`--netrc-file`](#netrc-file).<br> |
| <a href="#no-color" id="no-color"><code>--no-color</code></a> | Do not colorize output.<br><br>This is a cli-only option.<br> |
| <a href="#no-output" id="no-output"><code>--no-output</code></a> | Suppress output. By default, Hurl outputs the body of the last response.<br><br>This is a cli-only option.<br> |
| <a href="#no-pretty" id="no-pretty"><code>--no-pretty</code></a> | Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if<br>standard output is a terminal.<br><br>This is a cli-only option.<br> |
| <a href="#noproxy" id="noproxy"><code>--noproxy &lt;HOST(S)&gt;</code></a> | Comma-separated list of hosts which do not use a proxy.<br><br>Override value from Environment variable no_proxy.<br> |
| <a href="#ntlm" id="ntlm"><code>--ntlm</code></a> | Tell Hurl to use NTLM authentication<br> |
| <a href="#output" id="output"><code>-o, --output &lt;FILE&gt;</code></a> | Write output to FILE instead of stdout. Use '-' for stdout in [Options] sections.<br> |
| <a href="#parallel" id="parallel"><code>--parallel</code></a> | Run files in parallel.<br><br>Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in [`--test`](#test) mode.<br><br>See also [`--jobs`](#jobs).<br><br>This is a cli-only option.<br> |
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
| <a href="#pinnedpubkey" id="pinnedpubkey"><code>--pinnedpubkey &lt;HASHES&gt;</code></a> | When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, Hurl aborts the connection before sending or receiving any data.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, output os colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#pretty" id="pretty"><code>--pretty</code></a> | Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see[`--no-color`](#no-color) to format without color.<br><br>This is a cli-only option.<br> |
| <a href="#progress-bar" id="progress-bar"><code>--progress-bar</code></a> | Display a progress bar in test mode. The progress bar is displayed only in interactive TTYs. This option forces the progress bar to be displayed even in non-interactive TTYs.<br><br>This is a cli-only option.<br> |
| <a href="#proxy" id="proxy"><code>-x, --proxy &lt;[PROTOCOL://]HOST[:PORT]&gt;</code></a> | Use the specified proxy.<br> |
| <a href="#repeat" id="repeat"><code>--repeat &lt;NUM&gt;</code></a> | Repeat the input files sequence NUM times, -1 for infinite loop. Given a.hurl, b.hurl, c.hurl as input, repeat two<br>times will run a.hurl, b.hurl, c.hurl, a.hurl, b.hurl, c.hurl.<br> |

View File

@ -416,6 +416,15 @@ pub fn no_output() -> clap::Arg {
.action(clap::ArgAction::SetTrue)
}
pub fn no_pretty() -> clap::Arg {
clap::Arg::new("no_pretty")
.long("no-pretty")
.help("Do not prettify response output")
.help_heading("Output options")
.conflicts_with("pretty")
.action(clap::ArgAction::SetTrue)
}
pub fn noproxy() -> clap::Arg {
clap::Arg::new("noproxy")
.long("noproxy")

View File

@ -390,6 +390,9 @@ pub fn pretty(arg_matches: &ArgMatches, context: &RunContext) -> bool {
if has_flag(arg_matches, "pretty") {
return true;
}
if has_flag(arg_matches, "no_pretty") {
return false;
}
context.is_stdout_term()
}

View File

@ -236,6 +236,7 @@ pub fn parse(with_color: bool) -> Result<CliOptions, CliOptionsError> {
.arg(commands::json())
.arg(commands::no_color())
.arg(commands::no_output())
.arg(commands::no_pretty())
.arg(commands::output())
.arg(commands::pretty())
.arg(commands::progress_bar())