Skip to content

smartcontract/cli: improve tenant get output with table/JSON formatting#3148

Open
juan-malbeclabs wants to merge 4 commits intomainfrom
jo/3106
Open

smartcontract/cli: improve tenant get output with table/JSON formatting#3148
juan-malbeclabs wants to merge 4 commits intomainfrom
jo/3106

Conversation

@juan-malbeclabs
Copy link
Contributor

Summary of Changes

  • Added --json flag to tenant get command for machine-readable output
  • Replaced flat key-value output with formatted tables using tabled for human-readable display
  • Tenant config and administrators are now shown as separate tables
  • Administrators list is only shown when non-empty
  • Expanded test coverage for all combinations of --json and admin presence

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +148 / -14 +134

Single-file change adding structured output (table + JSON) to the tenant get CLI command.

Key files (click to expand)
  • smartcontract/cli/src/tenant/get.rs — rewrote output logic to use tabled tables and serde_json for --json mode; added ConfigDisplay and AdminDisplay structs; expanded tests

Testing Verification

  • Unit tests cover table output (with and without administrators) and JSON output (with and without administrators)
  • All four combinations of --json flag × admin presence are exercised

@juan-malbeclabs juan-malbeclabs linked an issue Mar 2, 2026 that may be closed by this pull request

#[derive(Tabled, Serialize)]
struct AdminDisplay {
#[tabled(rename = "administrator")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the rename necessary if it's the same as the field (above as well), just wondering whether it would work as is without the #[tabled(rename=...)] (assuming field is the name we want to keep in the table)

Copy link
Contributor

Choose a reason for hiding this comment

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

This applies to those in ConfigDisplay too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, changed.

@juan-malbeclabs
Copy link
Contributor Author

juan-malbeclabs commented Mar 3, 2026

In this other PR #3156 , I applied the same changes to the remaining commands to standardize both the human-readable output and the JSON output for integrations.

@elitegreg elitegreg self-requested a review March 3, 2026 19:02

#[derive(Tabled, Serialize)]
struct AdminDisplay {
#[tabled(rename = "administrator")]
Copy link
Contributor

Choose a reason for hiding this comment

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

This applies to those in ConfigDisplay too.

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.

Include administrators list in tenant get command

3 participants