potiuk commented on code in PR #34269:
URL: https://github.com/apache/airflow/pull/34269#discussion_r1321454122


##########
dev/breeze/src/airflow_breeze/commands/setup_commands.py:
##########
@@ -269,6 +271,24 @@ 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 validate_params_for_command(command_params, command):
+    global OPTIONS_COMMAND_MAP
+    if "params" in command_params:
+        for param in command_params["params"]:
+            name = param["name"]
+            opts = param["opts"]
+            if not is_common_param(name):
+                for opt in opts:
+                    if name not in OPTIONS_COMMAND_MAP:
+                        OPTIONS_COMMAND_MAP[opt] = [command]
+                    else:

Review Comment:
   For example you can modify (in common_options.py)
   
   ```
   option_upgrade_to_newer_dependencies = click.option(
       "-u",
       "--upgrade-to-newer-dependencies",
       is_flag=True,
       help="When set, upgrade all PIP packages to latest.",
       envvar="UPGRADE_TO_NEWER_DEPENDENCIES",
   )
   option_upgrade_on_failure = click.option(
       "--upgrade-on-failure",
       is_flag=True,
       help="When set, attempt to run upgrade to newer dependencies when 
regular build fails.",
       envvar="UPGRADE_ON_FAILURE",
   )
   ```
   
   to be:
   
   ```
   option_upgrade_to_newer_dependencies = click.option(
       "-u",
       "--upgrade-to-newer-dependencies",
       is_flag=True,
       help="When set, upgrade all PIP packages to latest.",
       envvar="UPGRADE_TO_NEWER_DEPENDENCIES",
   )
   option_upgrade_on_failure = click.option(
       "-u",  # <--- here added -u
       "--upgrade-on-failure",
       is_flag=True,
       help="When set, attempt to run upgrade to newer dependencies when 
regular build fails.",
       envvar="UPGRADE_ON_FAILURE",
   )
   ```
   
   and we want to detect duplicate is happening in `ci-image build` command 
(see the double `-u`):
   
   
   <img width="1234" alt="Screenshot 2023-09-11 at 14 09 56" 
src="https://github.com/apache/airflow/assets/595491/7c510fc3-249a-464f-8b73-fe2cb435b5e3";>
   
   
   



-- 
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]

Reply via email to