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

Do not hide remapped subcommands #831

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

marckhouzam
Copy link
Contributor

What this PR does / why we need it

If the plugin's descriptor's Hidden field is set to true, only the root command of the plugin should be hidden while any mapped subcommands should stay visible.

Which issue(s) this PR fixes

Fixes #830

Describe testing done for PR

I tested with a plugin that set the descriptor's Hidden field to true, and remaps a subcommand.

$ tz rbac info | jq
{
  "name": "rbac",
 [...]
 "hidden": true,
  "completionType": 0,
  "commandMap": [
    {
      "srcPath": "role",
      "dstPath": "role",
      "overrides": "",
      "description": "Tanzu Platform Role-Based Access Control",
      "aliases": [
        "roles"
      ]
    }
  ],
  "pluginRuntimeVersion": "v1.4.3",
  "binaryArch": "arm64"
}

# Notice that the role command is visible and that the rbac command is hidden
# Before this fix, the role command was also hidden
$ tz -h | egrep 'rbac|role'
    role                    Tanzu Platform Role-Based Access Control

Release note

Do not hide remapped subcommands when the plugin's root command is hidden.

Additional information

Special notes for your reviewer

If the plugin's descriptor Hidden field is set to true, only the root
command of the plugin should be hidden; any mapped subcommands should
stay visible.

Signed-off-by: Marc Khouzam <[email protected]>
@marckhouzam marckhouzam requested a review from a team as a code owner November 18, 2024 14:54
Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

LGTM.
Nice clean fix and tests.
Thanks for reporting and fixing the issue !

@marckhouzam marckhouzam merged commit 92c98e8 into vmware-tanzu:main Nov 19, 2024
8 checks passed
@marckhouzam marckhouzam deleted the fix/hiddenMappedCmd branch November 19, 2024 20:37
@marckhouzam marckhouzam added this to the v1.6.0 milestone Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A hidden root command for a plugin hides all remapped sub-commands
3 participants