amoghrajesh commented on code in PR #34269:
URL: https://github.com/apache/airflow/pull/34269#discussion_r1322966206
##########
dev/breeze/src/airflow_breeze/commands/setup_commands.py:
##########
@@ -269,6 +269,34 @@ def dict_hash(dictionary: dict[str, Any]) -> str:
return dhash.hexdigest()
+def is_common_param(name):
+ return name == "verbose" or name == "help" or name == "dry_run"
+
+
+def is_short_flag(opt):
+ return len(opt) == 2 and (not opt.startswith("--"))
+
+
+def validate_params_for_command(command_params, command):
+ options_command_map = {}
+ if "params" in command_params:
+ for param in command_params["params"]:
+ name = param["name"]
+ if not is_common_param(name):
+ for opt in param["opts"]:
+ if opt not in options_command_map:
+ options_command_map[opt] = [command]
+ else:
+ # same flag used in same command
+ if is_short_flag(opt):
+ get_console().print(
+ f"\n[error] {opt} have duplicate short hand
commands under command: "
+ f"{'breeze ' + command}\n"
+ )
+ return False
Review Comment:
Sure makes sense to do this
--
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]