Skip to content

Conversation

@kachick
Copy link
Contributor

@kachick kachick commented Nov 20, 2025

This PR aims to reduce panic occurrences caused by incorrect user options.
This prevents surprising new users who are not familiar with the tool.

Before

> ./target/debug/scraper --unknown

thread 'main' panicked at scraper/src/main.rs:73:19:
Unrecognized option: 'unknown'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

> curl -s https://learn.microsoft.com/en-gb/typography/opentype/spec/scripttags | ./target/debug/scraper

thread 'main' panicked at scraper/src/main.rs:116:41:
missing selector
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After

> ./target/debug/scraper --unknown
Unrecognized option: 'unknown'

> curl -s https://learn.microsoft.com/en-gb/typography/opentype/spec/scripttags | ./target/debug/scraper
missing selector

@kachick kachick marked this pull request as draft November 20, 2025 09:13
@kachick kachick changed the title Avoid panic for unknown flags and missing selector when using executable Avoid panic for unknown flags and invalid selectors when using executable Nov 20, 2025
@kachick kachick marked this pull request as ready for review November 20, 2025 10:02
@adamreichold adamreichold merged commit 4848e3c into rust-scraper:master Nov 20, 2025
5 checks passed
@kachick
Copy link
Contributor Author

kachick commented Nov 20, 2025

Thanks for your reviews 🙏

@kachick kachick deleted the cli-ex-usage branch November 20, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants