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

Add -a flag as alias for --annotation #782

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

duglin
Copy link
Contributor

@duglin duglin commented Apr 6, 2020

I find that I'm using annotations more and more and since -a
wasn't being used I decided we should save people from typing too much

Signed-off-by: Doug Davis [email protected]

Changes

  • add support for -a as an alias for --annotation

/lint

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 6, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@duglin: 0 warnings.

In response to this:

I find that I'm using annotations more and more and since -a
wasn't being used I decided we should save people from typing too much

Signed-off-by: Doug Davis [email protected]

Changes

  • add support for -a as an alias for --annotation

/lint

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.

@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 6, 2020
@navidshaikh
Copy link
Collaborator

navidshaikh commented Apr 7, 2020

We also have other flags starting with a, --async (deprecated but still there), --all-namespaces with -A alias, --args and --autoscale-window. IMO, if there are multiple flags starting with same letter, it becomes confusing to map aliases (--args flag is closest ).
Also, this depends on how popular the flag is to make a short hand alias for (as done for --label flag).

@duglin : should auto-completion help here?

@duglin
Copy link
Contributor Author

duglin commented Apr 7, 2020

Yep - it's a bit of a guessing game, and popularity contest.

I don't think it's confusing though since people learn quickly what works. -l seems to be ok and we have lots of --l... long named flags.

But, as of now, of all the --a... flags, I do think --annotation would be the most popular, so I'm just trying to make life a bit easier.

@@ -45,7 +45,7 @@ kn service create NAME --image IMAGE [flags]
### Options

```
--annotation stringArray Service annotation to set. name=value; you may provide this flag any number of times to set multiple annotations. To unset, specify the annotation name followed by a "-" (e.g., name-).
-a, --annotation stringArray Service annotation to set. name=value; you may provide this flag any number of times to set multiple annotations. To unset, specify the annotation name followed by a "-" (e.g., name-).
Copy link
Contributor

Choose a reason for hiding this comment

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

Im fine with that (except maybe that it can be easily confused with -A which is "for all namespaces")

Copy link
Contributor

Choose a reason for hiding this comment

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

on the other hand, why not -a for --arg ?

But as we already have -e and -l, for consistencies sake I'm fine with -a (but in general we should take care to give away single letter options not easily)

Copy link
Contributor Author

@duglin duglin Apr 7, 2020

Choose a reason for hiding this comment

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

I think --annotation would be used more than --arg, plus "arg" is shorter than "annotation" - so between the two I don't think "arg" needs as much UX help :-)

As for -A and -a .... not sure what to say, other than these things are case sensitive for a reason.

@rhuss
Copy link
Contributor

rhuss commented Apr 8, 2020

After no objections from the latest WG call, lets merge this PR.

Thanks, @duglin !

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 8, 2020
Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

There are some test errors, probably because of some e2e test refactorings.

Also, could you please an an entry to the CHANGELOG.adoc as well to reflect this change ?

serviceUpdate(t, it, r, "svc3", "-a", "alpha=direwolf", "-a", "brave-")
validateServiceAnnotations(t, it, r, "svc3", map[string]string{"alpha": "direwolf", "brave": ""})
serviceDelete(t, it, r, "svc3")

Copy link
Contributor

Choose a reason for hiding this comment

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

You probably have to adapt this part to fit the refactoring landed recently (that's why the build tests are failing)

@knative-prow-robot knative-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 8, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2020
@duglin
Copy link
Contributor Author

duglin commented Apr 8, 2020

@rhuss fixed testing issues

@duglin
Copy link
Contributor Author

duglin commented Apr 9, 2020

Added an entry to the change log too - I think it's all ready now

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

thanks !

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 9, 2020
@rhuss
Copy link
Contributor

rhuss commented Apr 9, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 9, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 9, 2020
@rhuss
Copy link
Contributor

rhuss commented Apr 9, 2020

/retest

Still looks like a flake

@duglin duglin force-pushed the addA branch 2 times, most recently from 5094df2 to cf39cd6 Compare April 10, 2020 02:23
@duglin
Copy link
Contributor Author

duglin commented Apr 10, 2020

/hold

I'm doing some testing to see why the tests are failing

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 10, 2020
I find that I'm using annotations more and more and since `-a`
wasn't being used I decided we should save people from typing too much

Signed-off-by: Doug Davis <[email protected]>
@duglin
Copy link
Contributor Author

duglin commented Apr 10, 2020

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 10, 2020
@duglin
Copy link
Contributor Author

duglin commented Apr 10, 2020

/retest

@navidshaikh navidshaikh changed the title Add -a flag as alias for --annotations Add -a flag as alias for --annotation Apr 10, 2020
Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: duglin, navidshaikh, rhuss

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

@knative-prow-robot knative-prow-robot merged commit 030279b into knative:master Apr 10, 2020
@duglin duglin deleted the addA branch April 10, 2020 11:55
@navidshaikh navidshaikh added this to the v0.14.0 milestone Apr 20, 2020
coryrc pushed a commit to coryrc/client that referenced this pull request May 14, 2020
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. cla: yes Indicates the PR's author has signed the CLA. lgtm 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.

5 participants