Remove --progress and --summary option.

This commit is contained in:
jcamiel 2022-09-30 14:31:54 +02:00
parent 02c50711d1
commit fb279b5a1e
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
2 changed files with 7 additions and 36 deletions

View File

@ -30,7 +30,6 @@ use crate::cli;
use crate::cli::CliError;
use crate::http::ClientOptions;
use crate::runner::Value;
use crate::util::logger::BaseLogger;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CliOptions {
@ -54,9 +53,8 @@ pub struct CliOptions {
pub no_proxy: Option<String>,
pub output: Option<String>,
pub output_type: OutputType,
pub progress: bool,
pub proxy: Option<String>,
pub summary: bool,
pub test: bool,
pub timeout: Duration,
pub to_entry: Option<usize>,
pub user: Option<String>,
@ -235,12 +233,6 @@ pub fn app(version: &str) -> Command {
.help("Write to FILE instead of stdout")
.num_args(1)
)
.arg(
clap::Arg::new("progress")
.long("progress")
.help("Print filename and status for each test (stderr) - deprecated use --test")
.action(ArgAction::SetTrue)
)
.arg(
clap::Arg::new("proxy")
.short('x')
@ -263,12 +255,6 @@ pub fn app(version: &str) -> Command {
.help("Generate html report to dir")
.num_args(1)
)
.arg(
clap::Arg::new("summary")
.long("summary")
.help("Print test metrics at the end of the run (stderr) - deprecated use --test")
.action(ArgAction::SetTrue)
)
.arg(
clap::Arg::new("test")
.long("test")
@ -330,7 +316,7 @@ pub fn app(version: &str) -> Command {
)
}
pub fn parse_options(matches: &ArgMatches, logger: &BaseLogger) -> Result<CliOptions, CliError> {
pub fn parse_options(matches: &ArgMatches) -> Result<CliOptions, CliError> {
let cacert_file = match get_string(matches, "cacert_file") {
None => None,
Some(filename) => {
@ -410,21 +396,7 @@ pub fn parse_options(matches: &ArgMatches, logger: &BaseLogger) -> Result<CliOpt
} else {
OutputType::ResponseBody
};
let progress = has_flag(matches, "progress");
if progress {
logger.warning(
"--progress option is deprecated and will be removed soon. Please use --test or --json",
);
}
let progress = progress || test;
let proxy = get_string(matches, "proxy");
let summary = has_flag(matches, "summary");
if summary {
logger.warning(
"--summary option is deprecated and will be removed soon. Please use --test or --json",
);
}
let summary = summary || test;
let timeout = match get_string(matches, "max_time") {
None => ClientOptions::default().timeout,
Some(s) => match s.parse::<u64>() {
@ -464,9 +436,8 @@ pub fn parse_options(matches: &ArgMatches, logger: &BaseLogger) -> Result<CliOpt
no_proxy,
output,
output_type,
progress,
proxy,
summary,
test,
timeout,
to_entry,
user,

View File

@ -209,7 +209,7 @@ fn execute(
&variables,
logger,
);
if cli_options.progress {
if cli_options.test {
logger.test_completed(&result);
}
result
@ -255,7 +255,7 @@ fn main() {
|| cli::has_flag(&matches, "interactive");
let color = cli::output_color(&matches);
let base_logger = BaseLogger::new(color, verbose);
let cli_options = cli::parse_options(&matches, &base_logger);
let cli_options = cli::parse_options(&matches);
let cli_options = unwrap_or_exit(cli_options, EXIT_ERROR_UNDEFINED, &base_logger);
let mut filenames = vec![];
@ -314,7 +314,7 @@ fn main() {
let content = cli::read_to_string(filename);
let content = unwrap_or_exit(content, EXIT_ERROR_PARSING, &base_logger);
let progress = if cli_options.progress {
let progress = if cli_options.test {
Some(Progress {
current,
total: filenames.len(),
@ -429,7 +429,7 @@ fn main() {
unwrap_or_exit(result, EXIT_ERROR_UNDEFINED, &base_logger);
}
if cli_options.summary {
if cli_options.test {
let duration = start.elapsed().as_millis();
let summary = get_summary(duration, &hurl_results);
base_logger.info(summary.as_str());