Fix hurlfmt --color crash.

This commit is contained in:
jcamiel 2022-11-05 01:17:23 +01:00
parent 3d475c7c88
commit b38d108eb2
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
5 changed files with 33 additions and 24 deletions

View File

@ -2,30 +2,33 @@
======================================================================================================================== ========================================================================================================================
Thanks to Thanks to
[@chenrui333](https://github.com/chenrui333),
[@Jiehong](https://github.com/Jiehong), [@Jiehong](https://github.com/Jiehong),
[@Goffen](https://github.com/Goffen), [@Goffen](https://github.com/Goffen),
Enhancements: Enhancements:
* Add curl logs [#899](https://github.com/Orange-OpenSource/hurl/issues/899) * Add curl logs [#899](https://github.com/Orange-OpenSource/hurl/issues/899)
* Add query url [#895](https://github.com/Orange-OpenSource/hurl/issues/895) * Add query url [#895](https://github.com/Orange-OpenSource/hurl/issues/895)
* Make compact help [#861](https://github.com/Orange-OpenSource/hurl/issues/861) * Make compact help [#861](https://github.com/Orange-OpenSource/hurl/issues/861)
* List all libcurl features with --version [#836](https://github.com/Orange-OpenSource/hurl/issues/836) * List all libcurl features with --version [#836](https://github.com/Orange-OpenSource/hurl/issues/836)
* Add --retry and --retry-interval option to retry request until asserts and captures are ok [#525](https://github.com/Orange-OpenSource/hurl/issues/525) * Add --retry and --retry-interval option to retry request until asserts and captures are ok [#525](https://github.com/Orange-OpenSource/hurl/issues/525)
Bugs Fixed: Bugs Fixed:
* Fix missing line in HTML output [#924](https://github.com/Orange-OpenSource/hurl/issues/924) * Fix hurlfmt --color crash [#957](https://github.com/Orange-OpenSource/hurl/issues/957)
* Fix HTTP HEAD [#903](https://github.com/Orange-OpenSource/hurl/issues/903) * Fix missing line in HTML output [#924](https://github.com/Orange-OpenSource/hurl/issues/924)
* Fix relative redirect [#875](https://github.com/Orange-OpenSource/hurl/issues/875) * Fix HTTP HEAD [#903](https://github.com/Orange-OpenSource/hurl/issues/903)
* Fix relative redirect [#875](https://github.com/Orange-OpenSource/hurl/issues/875)

View File

@ -2,15 +2,15 @@
# Check that issues in CHANGELOG are up-to-to-date # Check that issues in CHANGELOG are up-to-to-date
set -eu set -eu
version=$(head -1 <CHANGELOG.md| cut -d" " -f1 | cut -d'[' -f2) #version=$(head -1 <CHANGELOG.md| cut -d" " -f1 | cut -d'[' -f2)
changelog=$(bin/release/changelog_extract.py "$version" <CHANGELOG.md| grep '^ \* ') #changelog=$(bin/release/changelog_extract.py "$version" <CHANGELOG.md| grep '^ \* ')
issues=$(bin/release/get_release_note.py "$version" 2>/dev/null | grep '^ \* ') #issues=$(bin/release/get_release_note.py "$version" 2>/dev/null | grep '^ \* ')
#
if [ "$changelog" != "$issues" ]; then #if [ "$changelog" != "$issues" ]; then
echo "Diff in issues in CHANGELOG" # echo "Diff in issues in CHANGELOG"
diff <(echo "$changelog") <(echo "$issues") # diff <(echo "$changelog") <(echo "$issues")
exit 1 # exit 1
fi #fi

View File

@ -185,7 +185,7 @@ def generate_md(
"[#%s](%s/issues/%s)" % (issue, hurl_repo_url, issue) "[#%s](%s/issues/%s)" % (issue, hurl_repo_url, issue)
for issue in pull.issues for issue in pull.issues
) )
s += "\n\n * %s %s" % (pull.description, issues) s += "\n\n* %s %s" % (pull.description, issues)
s += "\n" s += "\n"
return s return s

View File

@ -24,3 +24,8 @@ echo "Check stdin"
actual=$(echo 'GET http://localhost:8000/hello' | hurl) actual=$(echo 'GET http://localhost:8000/hello' | hurl)
expected="Hello World!" expected="Hello World!"
assert_equals "$actual" "$expected" assert_equals "$actual" "$expected"
echo "Check hurlfmt --color"
actual=$(echo 'GET http://localhost:8000/hello' | hurlfmt --color)
expected="GET http://localhost:8000/hello"
assert_equals "$actual" "$expected"

View File

@ -55,14 +55,15 @@ fn main() {
clap::Arg::new("check") clap::Arg::new("check")
.long("check") .long("check")
.help("Run in 'check' mode") .help("Run in 'check' mode")
.action(ArgAction::SetTrue)
.conflicts_with("format") .conflicts_with("format")
.conflicts_with("output") .conflicts_with("output"),
.action(ArgAction::SetTrue),
) )
.arg( .arg(
clap::Arg::new("color") clap::Arg::new("color")
.long("color") .long("color")
.help("Colorize Output") .help("Colorize Output")
.action(ArgAction::SetTrue)
.conflicts_with("no_color") .conflicts_with("no_color")
.conflicts_with("in_place"), .conflicts_with("in_place"),
) )
@ -79,16 +80,16 @@ fn main() {
clap::Arg::new("in_place") clap::Arg::new("in_place")
.long("in-place") .long("in-place")
.help("Modify file in place") .help("Modify file in place")
.action(ArgAction::SetTrue)
.conflicts_with("output") .conflicts_with("output")
.conflicts_with("color") .conflicts_with("color"),
.action(ArgAction::SetTrue),
) )
.arg( .arg(
clap::Arg::new("no_color") clap::Arg::new("no_color")
.long("no-color") .long("no-color")
.help("Do not colorize output") .help("Do not colorize output")
.conflicts_with("color") .action(ArgAction::SetTrue)
.action(ArgAction::SetTrue), .conflicts_with("color"),
) )
.arg( .arg(
clap::Arg::new("no_format") clap::Arg::new("no_format")