Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Change shorthand --enable-type flag to avoid typo #1121

Merged
merged 2 commits into from
Aug 21, 2019

Conversation

font
Copy link
Contributor

@font font commented Aug 20, 2019

What this PR does / why we need it:
The --enable-type long option can be accidentally typed with only 1 - as in -enable-type resulting in the following error:

$ kubefedctl federate secret kubefed -enable-type
F0809 15:24:48.160303   17400 federate.go:150] Error: Error retrieving target Secret "able-type/kubefed": secrets "kubefed" not found

The error occurs because combined shorthand options as in -en are valid. If a shorthand option takes an argument, as in -n, it must be the last argument, so it interprets the rest of the command able-type as the namespace argument. This can be confusing and is only a special case because e and n are both shorthand flags while their combined use spells out the long form of an option.

This fixes that by changing the shorthand flag for --enable-type to -t instead of -e.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 20, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: font

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 20, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 20, 2019
Copy link
Contributor

@xunpan xunpan left a comment

Choose a reason for hiding this comment

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

@font
The shorthand of other related options are the first charactor of the long name for easy memorized.
What about change the long name to make it consistent with others?
e.g. s/enable-type/type-enabled/

@font
Copy link
Contributor Author

font commented Aug 20, 2019

The shorthand of other related options are the first charactor of the long name for easy memorized.
What about change the long name to make it consistent with others?
e.g. s/enable-type/type-enabled/

@xunpan Yes, that's the downside i.e. the shorthand letter is not the first character of the long name. Thanks for the suggestion. I think it's preferable to stick with enable-type instead of type-enabled. The alternative is to not allow a shorthand letter at all, but I thought a shorthand option might be preferable, even if it isn't the first letter of the long name.

@abhat
Copy link
Contributor

abhat commented Aug 20, 2019

The shorthand of other related options are the first charactor of the long name for easy memorized.
What about change the long name to make it consistent with others?
e.g. s/enable-type/type-enabled/

@xunpan Yes, that's the downside i.e. the shorthand letter is not the first character of the long name. Thanks for the suggestion. I think it's preferable to stick with enable-type instead of type-enabled. The alternative is to not allow a shorthand letter at all, but I thought a shorthand option might be preferable, even if it isn't the first letter of the long name.

Yeah, agree with @font - the verb-noun form is more intuitive and consistent IMO. But good suggestion nevertheless @xunpan.

@abhat
Copy link
Contributor

abhat commented Aug 20, 2019

/lgtm

@k8s-ci-robot
Copy link
Contributor

@abhat: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@xunpan
Copy link
Contributor

xunpan commented Aug 21, 2019

It is not a mandatory change but suggestion. I'm ok with your comments.

LGTM

@pmorie
Copy link
Contributor

pmorie commented Aug 21, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 21, 2019
@k8s-ci-robot k8s-ci-robot merged commit 1104366 into kubernetes-retired:master Aug 21, 2019
@font font added this to the v0.1.0 milestone Aug 21, 2019
@font font deleted the kubefedctl-short-flags branch August 24, 2019 00:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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 Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants