arkade
arkade copied to clipboard
No error message for failed install command
No error message when trying to install a non existing app.
Expected Behaviour
- Display an error message to the user.
- Suggest available applications using levenshtein distance. Cobra does that for the root-level commands but not for nested commands
- In case the application is available for
get
command, suggest to use it. For example when usingarkade install kind
the user most definitely intended to get it and not to install it on top of a cluster.
Current Behaviour
No error message is shown at all and the returned exit code is 0.
$ arkade install bla
$ echo $?
0
Are you a GitHub Sponsor (Yes/No?)
Check at https://github.com/sponsors/alexellis
- [ ] Yes
- [X] No
Possible Solution
It seems cli/cli implemented the suggestions themselves. I would expect cobra
to support it though.
https://github.com/cli/cli/blob/029d49f3b38ebd54cd84b23732bb7efabfce4896/pkg/cmd/root/help.go#L51-L76
Steps to Reproduce (for bugs)
- arkade install kind
Context
I was trying to get stuff and mistakenly used install
command instead of get
. Afterwards I noticed that install
doesn't return any error message to the user to inform him of his mistake.
Your Environment
- What Kubernetes distribution are you using?
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:52:00Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
- Operating System and version (e.g. Linux, Windows, MacOS):
uname -a
Linux kursa 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
- What arkade version is this?
arkade version
_ _
__ _ _ __| | ____ _ __| | ___
/ _` | '__| |/ / _` |/ _` |/ _ \
| (_| | | | < (_| | (_| | __/
\__,_|_| |_|\_\__,_|\__,_|\___|
Get Kubernetes apps the easy way
Version: 0.8.2
Git Commit: 8b3fbc0994129f6c14daef467593ae02799409c0
Hi @YuviGold
Thanks for taking time to suggest an enhancement.
I think we would be willing to take a look at a PR that returned a different exit code and message for a mistyped or non-existing CLI for download.
Then we can discuss the lazy matching and fuzzy matching separately after.
Alex
Thank you @alexellis
I created 2 PRs:
- [x] https://github.com/alexellis/arkade/pull/529
- [ ] https://github.com/spf13/cobra/pull/1500
I hope cobra will look into it soon :)