gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.
MIT License
1.57k stars 199 forks source link

Set enforce_https to false on the CLI #727

Closed plaindocs closed 1 year ago

plaindocs commented 2 years ago

From the 3->4 changelog

check_img_http was removed. All URLs are expected to be HTTPS; set enforce_https to false if you prefer keeping HTTP images around

Is that possible using the CLI? When using --enforce-https=false I get

/usr/local/share/gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:33:in `go': needless argument: --enforce-https=false (OptionParser::NeedlessArgument)
    from /usr/local/share/gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    from /usr/local/share/gems/gems/html-proofer-4.0.1/bin/htmlproofer:11:in `<top (required)>'
    from /usr/local/bin/htmlproofer:25:in `load'
    from /usr/local/bin/htmlproofer:25:in `<main>'
JackWilb commented 2 years ago

I'm also having this problem. Using --enforce-https false doesn't work either. It gives:

Error:  false does not exist

I assume the syntax from the issue description is the correct one

JackWilb commented 2 years ago

Another note, this problem seems to also occur for --check-external-hash=false. Maybe this is a larger issue with boolean CLI parameters

gjtorikian commented 2 years ago

Whoops, thanks for the report. 4.1 should fix this.

plaindocs commented 2 years ago

Thanks @gjtorikian you're a :star2:

Atarity commented 1 year ago

Still the same on 5.0.2 . In CLI below command was OK with 4.4.0

htmlproofer _site/ --extension .html --assume-extension .html --checks Links,Images,Scripts,OpenGraph --swap-attributes '{"img": [["src", "data-src"]] }' --enforce-https=false --ignore-status-codes 999,401 --disable-external=true --swap-urls www.mysite.com:localhost:4000

--disable-external=true also an issue.

ModischFabrications commented 1 year ago

Came here for the same error, might want to add something to the readme 😄

gjtorikian commented 1 year ago

5.x fixed this to make more logical sense and restore old behavior. Try

--disable-external true

(In other words, no =.)

Atarity commented 1 year ago

I've tried this without = → false does not exist (ArgumentError).

ruby 3.1.3, html-proofer 5.0.2

gjtorikian commented 1 year ago

Looking into it!

gjtorikian commented 1 year ago

Ah, I misread the original issue.

In 5.0, the commands changed:

This was done so that boolean expressions could use the --[no-]* syntax, which is common across Ruby CLI. Hope that helps!