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

Tenant view command support for output formatting #331

Merged
merged 4 commits into from
Feb 16, 2024

Conversation

hnrkndrssn
Copy link
Contributor

@hnrkndrssn hnrkndrssn commented Feb 16, 2024

This PR introduces a new helper method to add support for output formatting for view commands, similar to what there is for list commands.

This PR also converts the tenant view command to use this new formatting helper. Output below:

Default (Table) output formatting

❯ ./octopus tenant view "Tenant A" --space Default
NAME      DESCRIPTION  ID           TAGS
Tenant A               Tenants-301  Test/Foo, Hosting/Shared

Basic output formatting

❯ ./octopus tenant view "Tenant A" --space Default -f basic
Tenant A (Tenants-301)
Tags: Test/Foo, Hosting/Shared
No description provided
http://localhost:8065/app#/Spaces-1/tenants/Tenants-301/overview
View this tenant in Octopus Deploy: http://localhost:8065/app#/Spaces-1/tenants/Tenants-301/overview

JSON output formatting

❯ ./octopus tenant view "Tenant A" --space Default -f json
{
  "ClonedFromTenantId": "",
  "Description": "",
  "Name": "Tenant A",
  "SpaceId": "Spaces-1",
  "TenantTags": [
    "Test/Foo",
    "Hosting/Shared"
  ],
  "Id": "Tenants-301",
  "ProjectEnvironments": [
    {
      "Project": {
        "Id": "Projects-501",
        "Name": "Tenant test"
      },
      "Environments": [
        {
          "Id": "Environments-401",
          "Name": "Local"
        }
      ]
    }
  ]
}

@hnrkndrssn hnrkndrssn self-assigned this Feb 16, 2024
@hnrkndrssn hnrkndrssn changed the title View command support for output formatting Tenant view command support for output formatting Feb 16, 2024
@hnrkndrssn hnrkndrssn marked this pull request as ready for review February 16, 2024 04:34
Copy link
Contributor

@benPearce1 benPearce1 left a comment

Choose a reason for hiding this comment

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

Nicely done.

@hnrkndrssn hnrkndrssn merged commit 0112f1b into main Feb 16, 2024
4 checks passed
@hnrkndrssn hnrkndrssn deleted the henrik/viewoutputformatting branch February 16, 2024 05:01
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.

None yet

2 participants