kubernetes-sigs / krew

📦 Find and install kubectl plugins
https://krew.sigs.k8s.io
Apache License 2.0
6.42k stars 369 forks source link

krew outputs incorrect warning during "krew completion [..]" command if `KREW_ROOT` is set #767

Closed nifr closed 2 years ago

nifr commented 2 years ago

Scenario

I set KREW_ROOT to ${XDG_DATA_HOME}/krew. I add ${KREW_ROOT}/bin to PATH after running krew completion [..].

Note: I'm using zsh.

Result

I get a misleading warning.

Code

if (( $+commands[krew] )); then
  source <(krew completion zsh)
  path=(
    $path
    "${KREW_ROOT}/bin"
  )
fi

Misleading Warning

WARNING: To be able to run kubectl plugins, you need to add
the following to your ~/.zshrc:

    export PATH="${PATH}:${HOME}/.krew/bin"

and restart your shell.

Issues

  1. the warning does not reflect KREW_ROOT
    • should say i.e. export PATH="${PATH}:${KREW_ROOT:-"${HOME}/.krew"}/bin"
  2. the warning should be muted for the krew completion command
    • completions itself work without krew's bin dir in PATH
    • adding krew's bin dir to PATH after loading completions still results in a working setup

Notes

I'm aware that it is possible to get rid of the warning by loading the completions after adding krew's bin dir toPATH.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-ci-robot commented 2 years ago

@k8s-triage-robot: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/krew/issues/767#issuecomment-1250880879): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues and PRs according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.