potiuk commented on a change in pull request #21145:
URL: https://github.com/apache/airflow/pull/21145#discussion_r808907947



##########
File path: dev/breeze/src/airflow_breeze/utils/run_utils.py
##########
@@ -40,12 +41,22 @@ def run_command(
     verbose: bool = False,
     suppress_raise_exception: bool = False,
     suppress_console_print: bool = False,
+    env: Optional[Mapping[str, str]] = None,
     **kwargs,
 ):
     if verbose:
-        console.print(f"[blue]$ {' '.join(shlex.quote(c) for c in cmd)}")
+        command_to_print = ' '.join(shlex.quote(c) for c in cmd)
+        # if we pass environment variables to execute, then
+        env_to_print = ' '.join(f'{key}="{val}"' for (key, val) in 
env.items()) if env else ''
+        # Soft wrap allows to copy&paste and run resulting output as it has no 
hard EOL
+        console.print(f"[blue]{env_to_print} {command_to_print}[/]", 
soft_wrap=True)

Review comment:
       This one is interesting. Originally rich "hard" wraps the lines in 
console - so when you copy & paste such output, you get line breaks and if you 
have long line the copy&paste will fail. 
   
   The "soft_wrap" parameter of print, removes the hard line breaks, and now 
you can simply select the command printed in blue, copy &paste it and it should 
nicely work :).




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