Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#6481] improve(CLI): Refactor table output format #6483

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Abyss-lord
Copy link
Contributor

What changes were proposed in this pull request?

Refactor table output format, make it easier to test and scale.

Why are the changes needed?

Fix: #6481

Does this PR introduce any user-facing change?

No

How was this patch tested?

table format test

gcli metalake list -i  --output table

+-------------------+
|     Metalake      |
+-------------------+
| demo              |
| cli_demo          |
| demo_metalake     |
| test_cli_metalake |
| tyy               |
| demo3             |
+-------------------+

gcli metalake details -i --output table  -m demo_metalake

+---------------+-------------+
|   Metalake    |   Comment   |
+---------------+-------------+
| demo_metalake | new comment |
+---------------+-------------+

gcli catalog  list -i --output table  -m demo_metalake
+-------------------+
|      Catalog      |
+-------------------+
| File              |
| Hive_catalog      |
| Iceberg_catalog   |
| Mysql_catalog     |
| Test_hive_catalog |
+-------------------+

gcli catalog  details --name Hive_catalog  -i --output table  -m demo_metalake
+--------------+------------+----------+-------------+
|   Catalog    |    Type    | Provider |   Comment   |
+--------------+------------+----------+-------------+
| Hive_catalog | RELATIONAL | hive     | new comment |
+--------------+------------+----------+-------------+

plainformat test

gcli metalake list -i
# demo
# cli_demo
# demo_metalake
# test_cli_metalake
# demo3

gcli metalake details -i  -m demo_metalake
# demo_metalake, new comment

gcli catalog  list -i   -m demo_metalake
# File
# Hive_catalog
# Iceberg_catalog
# Mysql_catalog
# Test_hive_catalog

gcli catalog  details --name Hive_catalog  -i  -m demo_metalake
# Hive_catalog, RELATIONAL, hive, new comment

Refactor table output format, make  it easier to test and scale.
@Abyss-lord
Copy link
Contributor Author

Hi @justinmclean could you please review this PR when you have time? I’d really appreciate your feedback.

@justinmclean
Copy link
Member

In the plain form test, why does the output have #s in front of each line?

*/
public TableFormat(CommandContext context) {
super(context);
// TODO: add other options for TableFormat
Copy link
Member

@justinmclean justinmclean Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What other options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like sort or limit?

@Abyss-lord
Copy link
Contributor Author

In the plain form test, why does the output have #s in front of each line?

I manually added the # sign to distinguish between commands and results.

@Abyss-lord
Copy link
Contributor Author

@justinmclean I’ve finished updating the code. Please take a look at the PR again when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Refactor table output format
3 participants