-
Notifications
You must be signed in to change notification settings - Fork 64
Add search command (WIP) #11
base: latest
Are you sure you want to change the base?
Conversation
lib/commands/search.jsx
Outdated
return y.help().alias('help', 'h') | ||
.options(SearchCommand.options) | ||
}, | ||
options: Object.assign(require('../common-opts.js'), {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zkat What you were saying over here makes sense about passing the whole options object to libnpm.search
—so just to confirm, I don't need common-opts.js
at all for the search command, right? So I can change this to a figgy-pudding
object with all the libnpmsearch
opts?
return <div> | ||
<Color grey bold>Find a package: </Color> | ||
<TextInput value={terms} onChange={onChange} onSubmit={onSubmit} /> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, if I erase the textinput data and press "Enter" it does BOTH a search and an install (and closes the process). Or was I testing an older version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea! This is that weird input focus thing I mentioned in my Todos list. I saw that the ink-select-input
has an explicit focus
boolean prop, and I just realized ink-text-input
has the same prop undocumented. I just need to add some logic to juggle these intuitively...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So excited for this! 🎉
lib/components/search.jsx
Outdated
const libnpm = require('libnpm') | ||
|
||
|
||
const MAX_RESULTS = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really care to make something like this configurable. Just pick good defaults imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a separate thread I was talking about changing the yargs options to pass down all the options of libnpmsearch
, so this will just change to the default for the limit
option, but allow it to be overridden by the user.
FYI you'll need to accept #22 before I can merge this. |
@zkat Done! |
@zkat BTW, hoping to get to these changes this evening, sorry I've been a little slow... |
You're fine! Take your time. We're not gonna be launching this until like next year so just take care of yourself first and foremost, and then if you have some time left over, go ahead and hack for fun <3 |
ef5c1c9
to
48bac49
Compare
@zkat Got a few updates besides the ones I've already commented on... I've added an options object to the search command which is basically all of the I am also trying to mimic your comment style now 😄 (I saw the CONTRIBUTING guide too late). Let me know if you'd like me go back and modify my commit messages. Next I'm diving into that input focus thing—I have a good idea of user flow and might need to get a little hacky with it—and integrating the |
idea: Can we render things like a table? I think aligning the various elements will make it a lot more readable. |
I can make a Maybe another command would be cool too, a full-screen (like |
@zkat Yea, I think rendering results in a table is a great idea. I'll see if I can compose components from @larsgw That sounds good—I assume you're thinking like a one-liner? I was originally thinking of putting it at the bottom of the matches list, but people might miss it if there are a lot of results. |
How's it going with this? |
@zkat Good! Sorry for the radio silence. I've been ironing out different states of searching to get them feeling right, and also being distracted by holiday busy-ness and such. After that I'm going to take a stab at displaying matching packages in a table view, but I'm thinking if it's less-than-straightforward, it might be better to put that into a follow-up PR if that's alright with you. Same goes for the one-liner package view (displaying package info on one line when you highlight it). I'm not sure if this is something @larsgw is actively working on, or that I could/should work on, but it might be simpler in a separate PR. |
I haven't started on it yet, sorry for that. I was thinking of 3 lines of content, with maybe 2-3 lines of visual distinction (I like this one), but that's up to you. |
@larsgw No worries, you're not blocking me or anything. Let me know if you get started on it, and I'll do the same if I get to it first. Thanks! |
Just to make sure we don't do the same work twice: I made PR #38 |
@larsgw Awesome, thanks! |
ea8b0b9
to
e7ea10d
Compare
@zkat OK, I think this is ready for another look! I think I ironed out the input focus stuff—I did a few tests with and without an initial term search, then deleting and entering a new search and it's feeling pretty good. And I looked into using And once #38 is good to go, I can drop it in over here. Let me know what you think, thanks! |
This looks great so far! |
@zkat Awesome, thanks! For getting this merged, do you want the table display and the one-liner package description in place first? |
@chrisforrette oh geez sorry it took so long to notice this again! No, I don't think table display is necessary yet, but I'd like to see more of a summary for each displayed package. |
…and flow, installing a few Ink components for text input and package selection
…ent instead of an object
…ext and tweaked format of package scores
…rch options and passing them through to the search query call
…ect input entirely and conditionally rendering it instead
…ay alongside the 'installing...' message
…n search input should be edited
…removing JSX from command itself, changing search results state a bit to not display blank results when terms are deleted
e7ea10d
to
60091f5
Compare
@zkat Btw, is there a real package installer I should use yet? I noticed |
Hey guys any news about this feature? Would love to assist if any further help is needed |
@SchneiderOr I was waiting on #38 to implement here, I'll go nudge over there... |
@zkat Also I'm not sure if you saw my last comment, but is there a real install function I should wire up to this? Or should it remain nerfed? |
This is a work-in-progress PR to add an interactive
search
command totink
.Usage:
./bin/tink.js search
: Fully interactive package search./bin/tink.js search "some search term"
: Auto-execute a search for the passed in terms.Added dependencies:
[email protected]
[email protected]
[email protected]
Todos:
lib/common-opts.js
are being passed into theSearch
component but aren't addressed at all. We may not need all/any of those options, and we should add options to be passable to NPM search.PackageView
. This is being built by @larsgw and might happen after this PR, and would display package details when highlighting packages in search results.