retis-org / retis

Tracing packets in the Linux networking stack & friends
https://retis.readthedocs.io/en/stable/
100 stars 14 forks source link

cli: fix error messages on --help and --version #252

Closed dmendes-rh closed 1 year ago

dmendes-rh commented 1 year ago

Fixes #221.

As far as I can tell the issue should apply to all versions of Retis, not just those build on copr. The issue is that try_get_matches_from() returns an error for --help and --version arguments which bubbles up through the ?, leading main() to exit early.

The version and help information currently being shown is actually the formatted error message of either ErrorKind::DisplayHelp or ErrorKind::DisplayVersion being printed by the rust runtime upon main() exiting.

All the other command processing behavior should be preserved because ignore_errors() made it so that only help and version options were being caught by try_get_matches_from() anyway.

dmendes-rh commented 1 year ago

The commit message should be good now.