Repository navigation
feat: add ddev add-on search subcommand, fixes #7491 - #7554
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
ddev add-on search subcommand, fixes #7491
|
Something like this was suggested and implemented in this PR but ultimately abandonned. It's still not evident to me why. It also briefly used fuzzy search, but a commit removed that. Again, it's not evident to me why fuzzy wouldn't be desirable. Some fuzzy search libraries. https://github.com/sahilm/fuzzy The latter is newer and fancier and compares itself to the other two. Not sure which would be appropriate here. |
719c62f to
daff479
Compare
|
Rebased and fixed gofmt problem |
There was a problem hiding this comment.
This works well.
However, I think it should default to --all, otherwise its not obvious if there are other addons, or that we are only searching a subset of addon.
Example workflow
I want a "browsersync" addon
$ ddev add-on search browsersync
┌───────────────────────┬────────────────────────────────────────────────────┐
│ ADD-ON │ DESCRIPTION │
├───────────────────────┼────────────────────────────────────────────────────┤
│ ddev/ddev-browsersync │ Live-reload and HTTPS auto-refresh on file changes │
│ │ for DDEV* │
└───────────────────────┴────────────────────────────────────────────────────┘
1 repositories found matching 'browsersync'. Add-ons marked with '*' are officially maintained DDEV add-ons.Good, there's 1 addon. And its marked with "*" so its official. (wonder if there are other unofficial ones and how do I find them?)
I want a "vscode" addon:
$ ddev add-on search vscode
No add-ons found matching 'vscode'
Ok, none listed, official or otherwise. But I know I have an addon ....
$ ddev add-on search vscode --all
┌──────────────────────────────────┬─────────────────────────────────┐
│ ADD-ON │ DESCRIPTION │
├──────────────────────────────────┼─────────────────────────────────┤
│ tyler36/ddev-vscode-devcontainer │ Open a DDEV container in VSCode │
└──────────────────────────────────┴─────────────────────────────────┘
1 repositories found matching 'vscode'. Add-ons marked with '*' are officially maintained DDEV add-ons.Suggestion
-
Default to
--allsearch. (Personally prefer this option) -
Alternatively, update the non/found message to include something like to:
No add-ons found matching 'vscode'. Use "--all" to search official and unofficial add-ons.
Test
- ✅ Find official addon:
ddev addon search browsersync - ✅ Find unofficial addon:
ddev addon search qr --all - ✅ Find unofficial addon via description:
ddev addon search queries --all - ✅ Displays message when no addons found:
ddev addon search meatball --all - ✅ Displays relevant help message:
ddev addon search --all
|
I'd like to reiterate that this feature seems half-baked, at best, without fuzzy search. As it is, people have to already know exactly what they're looking for, and then spell it precisely correctly (or at least a subset of it). Fuzzy search would account for typos, slight differences (vs code vs vscode), and overall help with discoverability. It seems like a simple enough thing to add, no? |
The search command is using the same default as the list command because I'd expect to find the same behaviour in both. It also has the same issue of not giving any hint about other addons, and the --all flag. @rfay What do you think? Default to --all true (best replacing it with an --official flag to limit to those), or behaviour like now, but just with an added comment about the flag? For both the list, as well as the search commands. |
daff479 to
e5bc30c
Compare
|
Rebased |
stasadev
left a comment
There was a problem hiding this comment.
Previously, we had one ddev get command, and there was no choice between using different flags for different actions.
But now, with subcommands (thanks to @GuySartorelli), we can have different behavior.
I agree with @tyler36, the search subcommand is expected to search everywhere, so the --all flag is not needed here.
The search command is using the same default as the list command because I'd expect to find the same behaviour in both. It also has the same issue of not giving any hint about other addons, and the
--allflag.
@AkibaAT, what about using this in addon-list.go?
-func renderRepositoryList(repos []*github.Repository) string {
+func renderRepositoryList(repos []*github.Repository, officialOnly bool) string {-return out.String() + fmt.Sprintf("%d repositories found. Add-ons marked with '*' are officially maintained DDEV add-ons.", len(repos))
+message := out.String() + fmt.Sprintf("%d repositories found. Add-ons marked with '*' are officially maintained DDEV add-ons.", len(repos))
+if officialOnly {
+ message = message + "\nTo view all add-ons, use `ddev add-on list --all`"
+}
+return message|
I agree as well that people would expect to search all add-ons when using One thing that has changed since the beginning of add-ons is that these days there are a number of popular add-ons that don't really need to move to the "official" ddev namespace, but are still valuable to particular groups of users. |
e5bc30c to
49a1dbe
Compare
49a1dbe to
960704f
Compare
|
Rebased and dropped --all from list & search |
|
Why are you dropping |
I understood the last input as it no longer making sense to filter by "official" addons, and instead to always show all. |
960704f to
77f7653
Compare
77f7653 to
a58dacc
Compare
tyler36
left a comment
There was a problem hiding this comment.
Works well!
Thank you for sticking with this.
a58dacc to
89cf15a
Compare
89cf15a to
6c1d6e0
Compare
6c1d6e0 to
7b9b1a6
Compare
The Issue
How This PR Solves The Issue
Implemented a new search subcommand
Manual Testing Instructions
ddev add-on search "solr engine"Automated Testing Overview
Added new TestCmdAddonSearch
Release/Deployment Notes