This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-6-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 12b2ad63ce14e2af5324a8c3874c1e0f4754a429
Author: Pankaj Singh <[email protected]>
AuthorDate: Mon May 1 21:07:34 2023 +0530

    Fix `airflow providers get` command output (#30978)
    
    If I use the `airflow provider get <provider-name> -o json/yaml` CLI command
    it does not respect `-o` option.
    It works perfectly fine when I pass the `--full` option also in the above 
command.
    The issue is currently if the `--full` option is not provided we
    use standard statement print to print results and not the custom 
AirflowConsole.
    In this PR I'm replacing print with `AirflowConsole().print_as`
    
    (cherry picked from commit 23b5b31d48a1c8fc784022c641b33b4ba837d549)
---
 airflow/cli/commands/provider_command.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/airflow/cli/commands/provider_command.py 
b/airflow/cli/commands/provider_command.py
index cae6056794..893cfdd32e 100644
--- a/airflow/cli/commands/provider_command.py
+++ b/airflow/cli/commands/provider_command.py
@@ -44,8 +44,9 @@ def provider_get(args):
                 output=args.output,
             )
         else:
-            print(f"Provider: {args.provider_name}")
-            print(f"Version: {provider_version}")
+            AirflowConsole().print_as(
+                data=[{"Provider": args.provider_name, "Version": 
provider_version}], output=args.output
+            )
     else:
         raise SystemExit(f"No such provider installed: {args.provider_name}")
 

Reply via email to