[#6798] feat(CLI): Support TableFormat and PlainFormat for Model, User and Group.
What changes were proposed in this pull request?
Uniform CLI output format for Model, User and Group commands.
Why are the changes needed?
Uniform CLI output format for Model, User and Group commands.
Fix: #6798
Does this PR introduce any user-facing change?
Users can output multiple entities using the CLI's table format.
How was this patch tested?
local test + ut. TableFormat test.
bin/gcli.sh model list -m demo_metalake --name model_catalog.schema --output table
+--------+
| Name |
+--------+
| model2 |
+--------+
bin/gcli.sh model details -m demo_metalake --name model_catalog.schema.model2 --output table
+--------+-------------+----------------+
| Name | Comment | Latest version |
+--------+-------------+----------------+
| model2 | test rename | 0 |
+--------+-------------+----------------+
bin/gcli.sh user list -m demo_metalake --output table
+-----------+
| Name |
+-----------+
| anonymous |
| testRole |
| test_user |
+-----------+
bin/gcli.sh user details -m demo_metalake --user testRole --output table
The user has no roles.
bin/gcli.sh group list -m demo_metalake --output table
+---------------+
| Name |
+---------------+
| group_no_role |
| test_group |
+---------------+
bin/gcli.sh group details -m demo_metalake --group test_group --output table
The group has no roles.
PlainFormat test.
bin/gcli.sh model list -m demo_metalake --name model_catalog.schema
model2
bin/gcli.sh model list -m demo_metalake --name model_catalog.schema
Model name model2, comment: test rename, latest version: 0
bin/gcli.sh user list -m demo_metalake
anonymous
testRole
test_user
bin/gcli.sh user details -m demo_metalake --user testRole
The user has no roles.
bin/gcli.sh group list -m demo_metalake
group_no_role
test_group
bin/gcli.sh group details -m demo_metalake --group test_group
The group has no roles.
Hi @justinmclean , could you please review this PR when you have time? I’d really appreciate your feedback.
@justinmclean should we support all entity? include:
- Tag;
- Role;
- User;
- Group
- Fileset
- Model
- Topic
@justinmclean Can we add this PR in release 0.9?
@justinmclean Hi Justin, could you plz help to review this pr, I think we can add this PR in release 0.9.
I'm currently on holiday, so only took a quick look. My concern is that this changes the output of existing commands, which could be unexpected to users or break user scripts.
I'm currently on holiday, so only took a quick look. My concern is that this changes the output of existing commands, which could be unexpected to users or break user scripts.
@justinmclean plainFormat will continue to preserve the original output format and remains the default, so it will not affect existing user scripts. Since the Model object was only introduced in version 0.8, there are not many scripts associated with it, making this the ideal time to standardize its output. The main goal of this PR is to centralize the display methods so that all output can only be produced through the printInformation or printResults methods.
Yes but you have also changed the output of several plain commands.
Hi @justinmclean I've completed the code updates and would appreciate your review of the PR when you have a moment. Here's a summary of the commits:
- revert: Keep PlainFormat message as before.
Other than that one minor comment, it looks good to me
Hi @justinmclean I've completed the code updates and would appreciate your review of the PR when you have a moment. Here's a summary of the commits:
- Fix
ListGroupmessage.