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 use the CLIs sub-command help for the builder plugin #530

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

marckhouzam
Copy link
Contributor

What this PR does / why we need it

The 'builder' command is a plugin and therefore its help formatting is automatically done by the tanzu-plugin-runtime library.

Using SetUsageFunc(cli.SubCmdUsageFunc) formats the help without adding the tanzu root command in the help of the plugin.

This commit simply removes the use of SetUsageFunc(cli.SubCmdUsageFunc) for the builder plugin.

Which issue(s) this PR fixes

Fixes #529

Describe testing done for PR

Before the PR, using main, build and test with the plugin:

# Install the plugins built from main
$ tz plugin install --local-source artifacts/plugins/darwin/arm64 all
[i] Installing plugin 'builder:v1.1.0-dev' with target 'global'
[i] Installing plugin 'test:v1.1.0-dev' with target 'global'
[ok] successfully installed all plugins

# Notice the `tanzu` prefix in Usage for the root builder command
$ tz builder -h
Build Tanzu components

Usage:
  tanzu builder [command]

[...]

# But below, the `tanzu` prefix is missing
$ tz builder inventory -h
Inventory Operations

Usage:
  builder inventory [command]

[...]

$ tz builder inventory plugin -h
Plugin Inventory Operations

Usage:
  builder inventory plugin [command]

[...]

$ tz builder inventory plugin-group -h
Plugin-Group Inventory Operations

Usage:
  builder inventory plugin-group [command]

[...]

$ tz builder inventory init -h
Initialize empty plugin inventory database and publish it to the remote repository

Usage:
builder inventory init [flags]

[...]

$ tz builder plugin -h
Plugin Operations

Usage:
  builder plugin [command]

[...]

$ tz builder plugin build -h
Build plugins

Usage:
builder plugin build [flags]

[...]

$ tz builder plugin build-package -h
Build plugin packages OCI image as tar.gz file that can be published to any repository

Usage:
builder plugin build-package [flags]

[...]

# Notice this last one is ok because that sub-command tree does
# not call `SetUsageFunc(cli.SubCmdUsageFunc)``
$ tz builder cli add-plugin -h
Add a plugin to a repository

Usage:
  tanzu builder cli add-plugin NAME [flags]

[...]

With this PR, re-install the plugins:

# Install the plugins built from this PR
$ tz plugin install --local-source artifacts/plugins/darwin/arm64 all
[i] Installing plugin 'builder:v1.1.0-dev' with target 'global'
[i] Installing plugin 'test:v1.1.0-dev' with target 'global'
[ok] successfully installed all plugins

# Notice the `tanzu` prefix in Usage
$ tz builder -h
Build Tanzu components

Usage:
  tanzu builder [command]

[...]

# But below, the `tanzu` prefix is missing
$ tz builder inventory -h
Inventory Operations

Usage:
  tanzu builder inventory [command]

[...]

$ tz builder inventory plugin -h
Plugin Inventory Operations

Usage:
  tanzu builder inventory plugin [command]

[...]

$ tz builder inventory plugin-group -h
Plugin-Group Inventory Operations

Usage:
  tanzu builder inventory plugin-group [command]

[...]

$ tz builder inventory init -h
Initialize empty plugin inventory database and publish it to the remote repository

Usage:
  tanzu builder inventory init [flags]

[...]

$ tz builder plugin -h
Plugin Operations

Usage:
  tanzu builder plugin [command]

[...]

$ tz builder plugin build -h
Build plugins

Usage:
  tanzu builder plugin build [flags]

[...]

$ tz builder plugin build-package -h
Build plugin packages OCI image as tar.gz file that can be published to any repository

Usage:
  tanzu builder plugin build-package [flags]

[...]

# Notice this last one is still ok of course because that sub-command tree does
# not call `SetUsageFunc(cli.SubCmdUsageFunc)``
$ tz builder cli add-plugin -h
Add a plugin to a repository

Usage:
  tanzu builder cli add-plugin NAME [flags]

[...]

Release note

Fix the usage section of the help text for the builder plugin.

Additional information

Special notes for your reviewer

The 'builder' command is a plugin and therefore its help formatting is
automatically done by the tanzu-plugin-runtime library.

Using `SetUsageFunc(cli.SubCmdUsageFunc)` format the help without adding
the `tanzu` root command in the help of the plugin.

This commit simply removes the use of `SetUsageFunc(cli.SubCmdUsageFunc)`.

Signed-off-by: Marc Khouzam <kmarc@vmware.com>
@marckhouzam marckhouzam requested a review from a team as a code owner October 9, 2023 12:19
Copy link
Contributor

@anujc25 anujc25 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing this. 👍

@marckhouzam marckhouzam merged commit 5acb7ae into vmware-tanzu:main Oct 11, 2023
7 checks passed
@marckhouzam marckhouzam deleted the fix/builderHelp branch October 11, 2023 16:23
@marckhouzam marckhouzam added this to the 1.1.0 milestone Oct 20, 2023
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.

Missing 'tanzu' prefix in 'builder' plugin usage text
3 participants