Rename option --html

This commit is contained in:
Fabrice Reix 2021-11-08 11:09:09 +01:00 committed by Fabrice Reix
parent 934eb8d5b4
commit c6bf58030f
3 changed files with 23 additions and 3 deletions

View File

@ -89,6 +89,7 @@ jobs:
./test_curl_commands.sh tests/*.curl
./test_html_output.py tests/*.html
xmllint --noout tests/*.html
./report-html.sh
- name: Archive production artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}

View File

@ -4,13 +4,13 @@
set +e
rm -rf report/*
find tests -name "*.hurl" | sort | while read -r hurl_file; do
options=("--json report/tests.json" "--html report/html" "--output /dev/null")
options=("--json report/tests.json" "--report-html report/html" "--output /dev/null")
if test -f "${hurl_file%.*}.options"; then
options+=("$(cat "${hurl_file%.*}.options")")
fi
cmd="hurl $hurl_file ${options[*]}"
echo "$cmd"
$cmd >/tmp/test.stdout 2>/tmp/test.stderr
$cmd
exit_code=$?
if [ "$exit_code" -gt 4 ]; then

View File

@ -227,6 +227,13 @@ pub fn app() -> App<'static, 'static> {
.value_name("[PROTOCOL://]HOST[:PORT]")
.help("Use proxy on given protocol/host/port"),
)
.arg(
clap::Arg::with_name("report_html")
.long("report-html")
.value_name("DIR")
.help("Generate html report to dir")
.takes_value(true),
)
.arg(
clap::Arg::with_name("summary")
.long("summary")
@ -311,7 +318,19 @@ pub fn parse_options(matches: ArgMatches) -> Result<CliOptions, CliError> {
let fail_fast = !matches.is_present("fail_at_end");
let file_root = matches.value_of("file_root").map(|value| value.to_string());
let follow_location = matches.is_present("follow_location");
let html_dir = if let Some(dir) = matches.value_of("html") {
// deprecated
// Support --report-html and --html only for the current version
if matches.is_present("html") {
eprintln!("The option --html is deprecated. It has been renamed to --report-html.");
eprintln!("It will be removed in the next version");
}
let report_html = if let Some(dir) = matches.value_of("html") {
Some(dir)
} else {
matches.value_of("report_html")
};
let html_dir = if let Some(dir) = report_html {
let path = Path::new(dir);
if !path.exists() {
match std::fs::create_dir(path) {