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

fix: avoid defining function based on alias errors #86

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

luisdavim
Copy link
Contributor

@luisdavim luisdavim commented Jul 11, 2021

If users already have some aliases defined that collide with any of the functions defined here (if they for example also use https://github.com/ahmetb/kubectl-aliases) they will get an error saying "defining function based on alias" prefixing the function declarations with function will avoid this.

Signed-off-by: Luis Davim luis.davim@sendoso.com

Signed-off-by: Luis Davim <luis.davim@sendoso.com>
@kubermatic-bot kubermatic-bot added dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 11, 2021
@ievgenii-shepeliuk
Copy link

@luisdavim you should assign a person as kubermatic-bot suggest in the message above
to make a progress with the PR

@luisdavim
Copy link
Contributor Author

/assign @toschneck

@kron4eg
Copy link
Member

kron4eg commented Jul 30, 2021

@luisdavim

prefixing the function declarations with function will avoid this.

What will happen instead? Original aliases would be overridden? Also, I can't reproduce this in my bash.

@luisdavim
Copy link
Contributor Author

At least in zsh you get an error message saying that the function is based on an alias. It expands the alias before interpreting the function and fails.
This change solves that and ir should be compatible with both bash and zsh.

@luisdavim
Copy link
Contributor Author

If you google for "function based on alias error", you'll find various similar cases in other projects that were also solved like this.

Copy link
Member

@kron4eg kron4eg left a comment

Choose a reason for hiding this comment

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

/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2021
@kubermatic-bot
Copy link

LGTM label has been added.

Git tree hash: f8f9f17d0212613b2a0cad98957cc24f518015d0

@kubermatic-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kron4eg, luisdavim

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

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 30, 2021
@kubermatic-bot kubermatic-bot merged commit ed5f8a8 into kubermatic:master Jul 30, 2021
@kron4eg
Copy link
Member

kron4eg commented Jul 30, 2021

@luisdavim thanks for your contribution!

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. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants