Add experimental --secret option (no implementation).
This commit is contained in:
parent
64a171727e
commit
f81fa71ab8
|
|
@ -69,6 +69,7 @@ _hurl() {
|
|||
'*--resolve[Provide a custom address for a specific HOST and PORT pair]: :' \
|
||||
'--retry[Maximum number of retries, 0 for no retries, -1 for unlimited retries]: :' \
|
||||
'--retry-interval[Interval in milliseconds before a retry]: :' \
|
||||
'*--secret[Define a secret value]: :' \
|
||||
'--ssl-no-revoke[(Windows) Tell Hurl to disable certificate revocation checks]' \
|
||||
'--test[Activate test mode (use parallel execution)]' \
|
||||
'--to-entry[Execute Hurl file to ENTRY_NUMBER (starting at 1)]: :' \
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
|
|||
[CompletionResult]::new('--resolve', 'resolve', [CompletionResultType]::ParameterName, 'Provide a custom address for a specific HOST and PORT pair')
|
||||
[CompletionResult]::new('--retry', 'retry', [CompletionResultType]::ParameterName, 'Maximum number of retries, 0 for no retries, -1 for unlimited retries')
|
||||
[CompletionResult]::new('--retry-interval', 'retry-interval', [CompletionResultType]::ParameterName, 'Interval in milliseconds before a retry')
|
||||
[CompletionResult]::new('--secret', 'secret', [CompletionResultType]::ParameterName, 'Define a secret value')
|
||||
[CompletionResult]::new('--ssl-no-revoke', 'ssl-no-revoke', [CompletionResultType]::ParameterName, '(Windows) Tell Hurl to disable certificate revocation checks')
|
||||
[CompletionResult]::new('--test', 'test', [CompletionResultType]::ParameterName, 'Activate test mode (use parallel execution)')
|
||||
[CompletionResult]::new('--to-entry', 'to-entry', [CompletionResultType]::ParameterName, 'Execute Hurl file to ENTRY_NUMBER (starting at 1)')
|
||||
|
|
|
|||
|
|
@ -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 --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 --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --repeat --report-html --report-json --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 --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 --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --repeat --report-html --report-json --report-junit --report-tap --resolve --retry --retry-interval --secret --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ complete -c hurl -l report-tap -d 'Write a TAP report to FILE'
|
|||
complete -c hurl -l resolve -d 'Provide a custom address for a specific HOST and PORT pair'
|
||||
complete -c hurl -l retry -d 'Maximum number of retries, 0 for no retries, -1 for unlimited retries'
|
||||
complete -c hurl -l retry-interval -d 'Interval in milliseconds before a retry'
|
||||
complete -c hurl -l secret -d 'Define a secret value'
|
||||
complete -c hurl -l ssl-no-revoke -d '(Windows) Tell Hurl to disable certificate revocation checks'
|
||||
complete -c hurl -l test -d 'Activate test mode (use parallel execution)'
|
||||
complete -c hurl -l to-entry -d 'Execute Hurl file to ENTRY_NUMBER (starting at 1)'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
name: secret
|
||||
long: secret
|
||||
value: NAME=VALUE
|
||||
help: Define a secret value
|
||||
help_heading: Run options
|
||||
multi: append
|
||||
experimental: true
|
||||
---
|
||||
Define secret value to be redacted from logs and report.
|
||||
|
|
@ -535,6 +535,17 @@ pub fn retry_interval() -> clap::Arg {
|
|||
.num_args(1)
|
||||
}
|
||||
|
||||
pub fn secret() -> clap::Arg {
|
||||
clap::Arg::new("secret")
|
||||
.long("secret")
|
||||
.value_name("NAME=VALUE")
|
||||
.help("Define a secret value")
|
||||
.help_heading("Run options")
|
||||
.num_args(1)
|
||||
.action(clap::ArgAction::Append)
|
||||
.hide(true)
|
||||
}
|
||||
|
||||
pub fn ssl_no_revoke() -> clap::Arg {
|
||||
clap::Arg::new("ssl_no_revoke")
|
||||
.long("ssl-no-revoke")
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use hurl::runner::Value;
|
|||
use hurl_core::input::Input;
|
||||
use hurl_core::typing::{BytesPerSec, Count, DurationUnit};
|
||||
|
||||
use crate::cli::options::variables::{parse as parse_variable, parse_value};
|
||||
use crate::cli::options::variables;
|
||||
use crate::cli::options::{duration, CliOptionsError};
|
||||
use crate::cli::options::{ErrorFormat, HttpVersion, IpResolve, Output};
|
||||
use crate::cli::OutputType;
|
||||
|
|
@ -408,6 +408,18 @@ pub fn retry_interval(arg_matches: &ArgMatches) -> Result<Duration, CliOptionsEr
|
|||
get_duration(&s, DurationUnit::MilliSecond)
|
||||
}
|
||||
|
||||
pub fn secret(matches: &ArgMatches) -> Result<HashMap<String, Value>, CliOptionsError> {
|
||||
let mut secrets = HashMap::new();
|
||||
if let Some(secret) = get_strings(matches, "variable") {
|
||||
for s in secret {
|
||||
let (name, value) = variables::parse(&s)?;
|
||||
secrets.insert(name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(secrets)
|
||||
}
|
||||
|
||||
pub fn ssl_no_revoke(arg_matches: &ArgMatches) -> bool {
|
||||
has_flag(arg_matches, "ssl_no_revoke")
|
||||
}
|
||||
|
|
@ -448,7 +460,7 @@ pub fn variables(matches: &ArgMatches) -> Result<HashMap<String, Value>, CliOpti
|
|||
// Use environment variables prefix by HURL_
|
||||
for (env_name, env_value) in env::vars() {
|
||||
if let Some(name) = env_name.strip_prefix("HURL_") {
|
||||
let value = parse_value(env_value.as_str())?;
|
||||
let value = variables::parse_value(env_value.as_str())?;
|
||||
variables.insert(name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
|
@ -480,7 +492,7 @@ pub fn variables(matches: &ArgMatches) -> Result<HashMap<String, Value>, CliOpti
|
|||
if line.starts_with('#') || line.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let (name, value) = parse_variable(line)?;
|
||||
let (name, value) = variables::parse(line)?;
|
||||
variables.insert(name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
|
@ -488,7 +500,7 @@ pub fn variables(matches: &ArgMatches) -> Result<HashMap<String, Value>, CliOpti
|
|||
|
||||
if let Some(input) = get_strings(matches, "variable") {
|
||||
for s in input {
|
||||
let (name, value) = parse_variable(&s)?;
|
||||
let (name, value) = variables::parse(&s)?;
|
||||
variables.insert(name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ pub struct CliOptions {
|
|||
pub resolves: Vec<String>,
|
||||
pub retry: Option<Count>,
|
||||
pub retry_interval: Duration,
|
||||
pub secrets: HashMap<String, Value>,
|
||||
pub ssl_no_revoke: bool,
|
||||
pub tap_file: Option<PathBuf>,
|
||||
pub test: bool,
|
||||
|
|
@ -224,6 +225,7 @@ pub fn parse() -> Result<CliOptions, CliOptionsError> {
|
|||
.arg(commands::repeat())
|
||||
.arg(commands::retry())
|
||||
.arg(commands::retry_interval())
|
||||
.arg(commands::secret())
|
||||
.arg(commands::test())
|
||||
.arg(commands::to_entry())
|
||||
.arg(commands::variable())
|
||||
|
|
@ -293,6 +295,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
|||
let insecure = matches::insecure(arg_matches);
|
||||
let interactive = matches::interactive(arg_matches);
|
||||
let ip_resolve = matches::ip_resolve(arg_matches);
|
||||
let jobs = matches::jobs(arg_matches);
|
||||
let json_report_dir = matches::json_report_dir(arg_matches)?;
|
||||
let junit_file = matches::junit_file(arg_matches);
|
||||
let limit_rate = matches::limit_rate(arg_matches);
|
||||
|
|
@ -312,6 +315,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
|||
let resolves = matches::resolves(arg_matches);
|
||||
let retry = matches::retry(arg_matches);
|
||||
let retry_interval = matches::retry_interval(arg_matches)?;
|
||||
let secrets = matches::secret(arg_matches)?;
|
||||
let ssl_no_revoke = matches::ssl_no_revoke(arg_matches);
|
||||
let tap_file = matches::tap_file(arg_matches);
|
||||
let test = matches::test(arg_matches);
|
||||
|
|
@ -323,7 +327,6 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
|||
let variables = matches::variables(arg_matches)?;
|
||||
let verbose = matches::verbose(arg_matches);
|
||||
let very_verbose = matches::very_verbose(arg_matches);
|
||||
let jobs = matches::jobs(arg_matches);
|
||||
Ok(CliOptions {
|
||||
aws_sigv4,
|
||||
cacert_file,
|
||||
|
|
@ -371,6 +374,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
|||
resolves,
|
||||
retry,
|
||||
retry_interval,
|
||||
secrets,
|
||||
ssl_no_revoke,
|
||||
tap_file,
|
||||
test,
|
||||
|
|
|
|||
Loading…
Reference in New Issue