arkade icon indicating copy to clipboard operation
arkade copied to clipboard

Feature request: Add fuzzy searching or pager to arkade get

Open yankeexe opened this issue 2 years ago • 4 comments

arkade get without any argument dumps a list of CLIs it can install in a table format. It's hard to search for the tool one is looking for. It will get harder as the list of tools we add increases.

It would be great if we could do one of these two things:

  1. view table as a pager so that users can scan through it with ease or search easily using /
  2. add fuzzy searching to quickly find the tool the user is looking for. The way I purpose this is with the --search or -s flag, along with arkade get
arkade get -s

arkade get --search 

# Note: Will have to ignore the flag if the user has passed an argument. 

Expected Behaviour

Option to search and view the tools arkade can install in an intuitive way using a fuzzy search or a pager.

Current Behaviour

arkade get dumps the list of all the tools and their description in a table.

Are you a GitHub Sponsor (Yes/No?)

Check at https://github.com/sponsors/alexellis

  • [ ] Yes
  • [x] No

Possible Solution

Add fuzzy search or a pager feature to easily allow users to search for the tool they are looking for.

Steps to Reproduce (for bugs)

arkade get

Context

I use arkade to install most of my Kubernetes tooling, and to look for it I use arkade get command, but it has been hard to look for the right tool in the table format, as the list is huge and search sometimes behaves weird in tmux.

Your Environment

  • What arkade version is this? 0.7.22

yankeexe avatar Jul 24 '21 04:07 yankeexe

hello @yankeexe, maybe this package might helpful: https://github.com/ktr0731/go-fuzzyfinder

developer-guy avatar Oct 14 '21 07:10 developer-guy

I would love to help, can you please let me know when you start to work on this issue, maybe we can do it together 😋 you can learn English from me, you know my English is perfect 😜

developer-guy avatar Oct 14 '21 07:10 developer-guy

Hey @yankeexe, this is a great idea, I thought of this immediately when I used arkade for the first time. brew and yum both have the command search:

  • brew search <package>
  • yum search <package> so following tradition, we could implement it that way as well

adowair avatar Jan 29 '22 15:01 adowair

Design Proposal

First off, thanks @alexellis for making this tool and sharing it with us. I'm giving designing this feature a go–this is my first time contributing to this project, so I'd appreciate feedback and advice. Arkade can be used to install two kinds of "things", both CLIs (via arkade get), and apps (via arkade install). One concern I had when thinking about this feature is: how to implement searching for both of these groups, without confusing the user about what is a CLI and what is an app.

Proposed usage

We can introduce a search command to search both CLIs and apps arkade supports. We can do a fuzzy search and return any results that roughly match the search term. Borrowing brew's ux:

$ arkade search fo
==> CLIs (arkade get <cli>)
foo  fooz  afo

==> Apps (arkade install <app>)
appfo forza

Alternative 1: arkade get --search and arkade install --search

Although splitting search into two distinct commands won't confuse users as to which is which, these commands are harder to discover (have to do --help twice to see these options) and less intuitive.

Alternative 2: arkade get and arkade install do fuzzy search by default

For example:

$ arkade get kubectl
Found kubectl, do you want to install (y/n)?
$ arkade get kube
Found these options:
kube-bench    kubebuilder    kubecm    kubectl    kubectx    kubetail    kubestr

This option means that it's hard for the user to mess up (if they get or install something that doesn't exist, we'll give them suggestions), but the downside is getting/installing a tool that does exist becomes a two step process.

@alexellis what do you think of these options? I'd be happy to submit a PR for this once I have the green light from you =). Thank you for making this!!

adowair avatar Mar 13 '22 07:03 adowair