broken-link-checker icon indicating copy to clipboard operation
broken-link-checker copied to clipboard

[Feature Request] add excludelist as file

Open mmattel opened this issue 6 years ago • 2 comments

Currently you add excludes one by one with --exclude localhost --exclude example.com ect.

It would be very beneficial if you could reference a file having a list of excludes one by line like: --exclude-file myfile.txt

An example of myfile.txt

example.com
www.example.com
subdomain.example.com

Benefit, the list would be easy maintainable while the command itself stays the same.

mmattel avatar Mar 29 '19 18:03 mmattel

This is what I'm doing until we get this done :D

Create a file called exclusions.txt

youtube.com linkedin.com

I create a variable with the exclusions in the format that blc expects:

exclusions=$(sed 's/(.*)/--exclude \1/' exclusions.txt | tr -d \n)

This will create a variable containing: --exclude youtube.com --exclude linkedin.com

And then:

blc -rof ${exclusions} --filter-level 1 https://example.org

BBerastegui avatar Sep 23 '19 13:09 BBerastegui

create a variable with the exclusions in the format that blc expects:

exclusions=$(sed 's/(.*)/--exclude \1/' exclusions.txt | tr -d \n)

~FYI my system (Ubuntu 19.04) didn't like the sed parameter \1/, so I ended up with:~

Forget all that. What it needed was -r and to replace (not delete) the newline:

exclusions=$(sed -r 's/(.*)/--exclude \1/' exclude.txt | tr '\n' ' ')

P.S. If you're using zsh, switch to bash for this.

alexfornuto avatar Sep 24 '19 18:09 alexfornuto