mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-10-26 08:18:26 +03:00
Add experimental max-workers option.
This commit is contained in:
parent
0931c32510
commit
88b7c04ed5
@ -46,6 +46,7 @@ _hurl() {
|
||||
'--json[Output each Hurl file result to JSON]' \
|
||||
'--max-redirs[Maximum number of redirects allowed, -1 for unlimited redirects]: :' \
|
||||
'(-m --max-time)'{-m,--max-time}'[Maximum time allowed for the transfer]: :' \
|
||||
'--max-workers[(Experimental) Maximum number of parallel execution]: :' \
|
||||
'(-n --netrc)'{-n,--netrc}'[Must read .netrc for username and password]' \
|
||||
'--netrc-file[Specify FILE for .netrc]: :_files' \
|
||||
'--netrc-optional[Use either .netrc or the URL]' \
|
||||
|
@ -51,6 +51,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
|
||||
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'Output each Hurl file result to JSON')
|
||||
[CompletionResult]::new('--max-redirs', 'max-redirs', [CompletionResultType]::ParameterName, 'Maximum number of redirects allowed, -1 for unlimited redirects')
|
||||
[CompletionResult]::new('--max-time', 'max-time', [CompletionResultType]::ParameterName, 'Maximum time allowed for the transfer')
|
||||
[CompletionResult]::new('--max-workers', 'max-workers', [CompletionResultType]::ParameterName, '(Experimental) Maximum number of parallel execution')
|
||||
[CompletionResult]::new('--netrc', 'netrc', [CompletionResultType]::ParameterName, 'Must read .netrc for username and password')
|
||||
[CompletionResult]::new('--netrc-file', 'netrc-file', [CompletionResultType]::ParameterName, 'Specify FILE for .netrc')
|
||||
[CompletionResult]::new('--netrc-optional', 'netrc-optional', [CompletionResultType]::ParameterName, 'Use either .netrc or the URL')
|
||||
|
@ -5,7 +5,7 @@ _hurl()
|
||||
_init_completion || return
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --delay --error-format --fail-at-end --file-root --location --location-trusted --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --json --max-redirs --max-time --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-junit --report-tap --resolve --retry --retry-interval --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 --delay --error-format --fail-at-end --file-root --location --location-trusted --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --json --max-redirs --max-time --max-workers --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-junit --report-tap --resolve --retry --retry-interval --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -29,6 +29,7 @@ complete -c hurl -l ipv6 -d 'Tell Hurl to use IPv6 addresses only when resolving
|
||||
complete -c hurl -l json -d 'Output each Hurl file result to JSON'
|
||||
complete -c hurl -l max-redirs -d 'Maximum number of redirects allowed, -1 for unlimited redirects'
|
||||
complete -c hurl -l max-time -d 'Maximum time allowed for the transfer'
|
||||
complete -c hurl -l max-workers -d '(Experimental) Maximum number of parallel execution'
|
||||
complete -c hurl -l netrc -d 'Must read .netrc for username and password'
|
||||
complete -c hurl -l netrc-file -d 'Specify FILE for .netrc'
|
||||
complete -c hurl -l netrc-optional -d 'Use either .netrc or the URL'
|
||||
|
12
docs/spec/options/hurl/max_workers.option
Normal file
12
docs/spec/options/hurl/max_workers.option
Normal file
@ -0,0 +1,12 @@
|
||||
name: max_workers
|
||||
long: max-workers
|
||||
value: NUM
|
||||
value_default: 6
|
||||
value_parser: clap::value_parser!(u32).range(1..)
|
||||
help: (Experimental) Maximum number of parallel execution
|
||||
cli_only: true
|
||||
experimental: true
|
||||
---
|
||||
(Experimental) Maximum number of parallel execution in parallel mode.
|
||||
|
||||
See also [`--parallel`](#parallel).
|
@ -7,3 +7,5 @@ experimental: true
|
||||
(Experimental) Run files in parallel.
|
||||
|
||||
Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential.
|
||||
|
||||
See also [`--max-workers`](#max-workers).
|
||||
|
@ -284,6 +284,17 @@ pub fn max_time() -> clap::Arg {
|
||||
.num_args(1)
|
||||
}
|
||||
|
||||
pub fn max_workers() -> clap::Arg {
|
||||
clap::Arg::new("max_workers")
|
||||
.long("max-workers")
|
||||
.value_name("NUM")
|
||||
.default_value("6")
|
||||
.value_parser(clap::value_parser!(u32).range(1..))
|
||||
.help("(Experimental) Maximum number of parallel execution")
|
||||
.num_args(1)
|
||||
.hide(true)
|
||||
}
|
||||
|
||||
pub fn netrc() -> clap::Arg {
|
||||
clap::Arg::new("netrc")
|
||||
.long("netrc")
|
||||
|
@ -246,6 +246,12 @@ pub fn max_redirect(arg_matches: &ArgMatches) -> Option<usize> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max_workers(arg_matches: &ArgMatches) -> usize {
|
||||
get::<u32>(arg_matches, "max_workers")
|
||||
.map(|m| m as usize)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn netrc(arg_matches: &ArgMatches) -> bool {
|
||||
has_flag(arg_matches, "netrc")
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ pub struct CliOptions {
|
||||
pub ip_resolve: Option<IpResolve>,
|
||||
pub junit_file: Option<String>,
|
||||
pub max_redirect: Option<usize>,
|
||||
pub max_workers: usize,
|
||||
pub netrc: bool,
|
||||
pub netrc_file: Option<String>,
|
||||
pub netrc_optional: bool,
|
||||
@ -189,6 +190,7 @@ pub fn parse() -> Result<CliOptions, CliOptionsError> {
|
||||
.arg(commands::json())
|
||||
.arg(commands::max_redirects())
|
||||
.arg(commands::max_time())
|
||||
.arg(commands::max_workers())
|
||||
.arg(commands::netrc())
|
||||
.arg(commands::netrc_file())
|
||||
.arg(commands::netrc_optional())
|
||||
@ -260,6 +262,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
||||
let ip_resolve = matches::ip_resolve(arg_matches);
|
||||
let junit_file = matches::junit_file(arg_matches);
|
||||
let max_redirect = matches::max_redirect(arg_matches);
|
||||
let max_workers = matches::max_workers(arg_matches);
|
||||
let netrc = matches::netrc(arg_matches);
|
||||
let netrc_file = matches::netrc_file(arg_matches)?;
|
||||
let netrc_optional = matches::netrc_optional(arg_matches);
|
||||
@ -311,6 +314,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
||||
ip_resolve,
|
||||
junit_file,
|
||||
max_redirect,
|
||||
max_workers,
|
||||
netrc,
|
||||
netrc_file,
|
||||
netrc_optional,
|
||||
|
Loading…
Reference in New Issue
Block a user