Closed Qix- closed 9 years ago
Great idea!
This should be pretty straightforward: Wat already tracks your command history, and, for example, if you've recently asked for 3 or more commands from a particular language or lib, it'll download all the markdown locally for that language in the background so there's no latency in future commands.
How about this:
When a user types in invalid command, I parse the index, find all partial matches, scoring them based on two-word matches, etc. etc.
I then weight the scoring by a priority scoring on the languages you use most. Any language you've never searched for gets a negative scoring. Then it'll do something like:
? printf
Did you mean:
1. c printf
2. ...
3. ...
Maybe languages that have never been queried get omitted entirely.
Then the user can type:
? 1
And then it will pull up the first option: c printf
.
I can also highlight the string matches in yellow background-highlighter or something.
I wouldn't omit entirely. I probably haven't ever looked up Ruby stuff, though if I wanted to learn one day not seeing anything in Wat about Ruby would be discouraging. Score negatively, but include if there are empty spots.
Also, as far as the 1, 2, 3
menu pattern goes, I would discourage it for languages in particular. My reflexes are going to be quicker than to look at a menu when I see Language
- my brain is going to realize it's asking for a language disambiguation and type in the language I'm looking for before my eyes even see the menu. :)
Ok no probs.
Almost done with this feature.
BTW, try this:
npm install -g wat
wat stackoverflow array concat
:fire:
First one was a mistake. Second one should have worked :X
Did you re-install? The version I published 2 hours ago should have it. But wait anyway - I finished the other thing. Let me republish.
Btw you can also type so array concat
or stack array concat
.
Ok try to install again.
So on this search implementation:
Showing "blah" instead
, and will just up and show the closest command.Did you mean:
and list them out. It highlights the word matches.I need more content in order to try out more conflicts, but it's a start.
@Qix- Did that so
command ever work for you? If you run another install now, I've got a ton of updates, including the actual topic of this issue :)
@dthree
Ahhhh 1 sec. Not doing another thing on this project until I write tests haha.
@Qix- Ok fixed.
This is handled now. To see how it works now, do;
$ npm install -g wat
$ wat tour
I could see this having a huge impact on other languages, such as C (for instance). Yes, man pages help, but are sometimes much more than what you need (i.e. the common example you use of argument order, etc.).
If I do
wat printf
, I'm going to get a few different results for a few different languages. Likewise, if I dowat println
, I might get a few different options for clarification.What would be cool to see in Wat is an engine for determining what result the user is most likely looking for, and filling in any missing pieces through continued prompt(s).
For instance, when I do type
printf
and there are are a few languages -c
andphp
, namely - wat would askLanguage?
, in which I could respondc
.Further, for the REPL version, it might even be useful to specify what language(s) you're looking for. If I'm a C/JS developer, I will literally never be looking for PHP information.
lang c, js
or some similar command would be a hint to the clarity engine that I'm going to be looking for language results in eitherc
orjs
(javascript).This would be an incredible tool in my arsenal.