tarun-google commented on code in PR #36072:
URL: https://github.com/apache/beam/pull/36072#discussion_r2337249300
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -449,11 +450,31 @@ def from_dictionary(cls, options):
return cls(flags)
+ @staticmethod
+ def _warn_on_unknown_options(unknown_args, parser):
+ if not unknown_args:
+ return
+
+ all_known_options = [
+ opt for action in parser._actions for opt in action.option_strings
+ ]
+
+ for arg in unknown_args:
+ if not arg.startswith('--'):
+ continue
+ arg_name = arg.split('=', 1)[0]
+ suggestions = difflib.get_close_matches(arg_name, all_known_options)
+ msg = f"Unparseable argument: {arg}"
+ if suggestions:
+ msg += f". Did you mean '{suggestions[0]}'?"
+ _LOGGER.warning(msg)
Review Comment:
I think we are discussing on a resolved comment. I already made a change to
warn on all unknown args, it should include short format too. But only while
adding suggestions i take longer format string, i do not think suggestions are
reasonable with shorter format. Is there a different expectation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]