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

⚠️ Explicitly define WithCompletion as an Option #2045

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

Adirio
Copy link
Contributor

@Adirio Adirio commented Feb 26, 2021

Output of go doc ./pkg/cli:

Current state:

package cli // import "sigs.k8s.io/kubebuilder/v3/pkg/cli"

func WithCompletion(c *cli) error
type CLI interface{ ... }
    func New(opts ...Option) (CLI, error)
type Option func(*cli) error
    func WithCommandName(name string) Option
    func WithDefaultPlugins(projectVersion config.Version, plugins ...plugin.Plugin) Option
    func WithDefaultProjectVersion(version config.Version) Option
    func WithExtraCommands(cmds ...*cobra.Command) Option
    func WithPlugins(plugins ...plugin.Plugin) Option
    func WithVersion(version string) Option

With this PR:

package cli // import "sigs.k8s.io/kubebuilder/v3/pkg/cli"

type CLI interface{ ... }
    func New(opts ...Option) (CLI, error)
type Option func(*cli) error
    func WithCommandName(name string) Option
    func WithCompletion() Option
    func WithDefaultPlugins(projectVersion config.Version, plugins ...plugin.Plugin) Option
    func WithDefaultProjectVersion(version config.Version) Option
    func WithExtraCommands(cmds ...*cobra.Command) Option
    func WithPlugins(plugins ...plugin.Plugin) Option
    func WithVersion(version string) Option

Closes: #2044

Signed-off-by: Adrian Orive <adrian.orive.oneca@gmail.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 26, 2021
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 26, 2021
@Adirio Adirio mentioned this pull request Feb 26, 2021
14 tasks
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

It changes the API. However, it is a bug fix. Could you please change the mojo?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio, camilamacedo86

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Adirio,camilamacedo86]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Adirio
Copy link
Contributor Author

Adirio commented Feb 26, 2021

It changes the API. However, it is a bug fix. Could you please change the mojo?

It is not a bug-fix, it works as it is right now. It just improves the API. Therefore, it is a breaking change but it is not fixing anything.

@camilamacedo86
Copy link
Member

It is not a bug-fix, it works as it is right now. It just improves the API. Therefore, it is a breaking change but it is not fixing anything.

My point is that besides it works it should be defined as an Option since is an Option. So, it is a bug in the API definition. However, I am not very strong opinionated here. It shows fine too.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 26, 2021
@k8s-ci-robot k8s-ci-robot merged commit cfbf62d into kubernetes-sigs:master Feb 26, 2021
@Adirio Adirio deleted the completion-option branch February 26, 2021 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert WithCompletion into a cli.Option
3 participants