bugraoz93 commented on code in PR #50919:
URL: https://github.com/apache/airflow/pull/50919#discussion_r2110283715


##########
airflow-ctl/src/airflowctl/ctl/commands/version_command.py:
##########
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from airflow.utils.platform import get_airflow_git_version
+from airflow.version import version
+from airflowctl.api.client import NEW_API_CLIENT, ClientKind, 
provide_api_client
+
+
+@provide_api_client(kind=ClientKind.CLI)
+def version_info(arg, api_client=NEW_API_CLIENT):
+    """Get version information."""
+    version_dict = {
+        "airflow_version": version,

Review Comment:
   I think we should get this from the operation itself. You excluded indeed 
the VersionOperation, which is great, but in here we should call and parse the 
result accordingly with `version_response = api_client.version.get()`, then we 
need to cascade this to the version dict before printing.



##########
airflow-ctl/src/airflowctl/ctl/commands/version_command.py:
##########
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from airflow.utils.platform import get_airflow_git_version
+from airflow.version import version
+from airflowctl.api.client import NEW_API_CLIENT, ClientKind, 
provide_api_client
+
+
+@provide_api_client(kind=ClientKind.CLI)
+def version_info(arg, api_client=NEW_API_CLIENT):
+    """Get version information."""
+    version_dict = {
+        "airflow_version": version,
+        "git_version": get_airflow_git_version(),
+        "airflowctl_version": version,
+    }
+
+    for name, value in version_dict.items():
+        print(f"{name} : {value}")

Review Comment:
   Could we please use `rich.print` for the output?



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