siddharthkp / historie

A searchable history cli
MIT License
60 stars 2 forks source link

fixes #2 of not showing recent commands on typing historie #8

Closed hamxabaig closed 7 years ago

hamxabaig commented 7 years ago

I checked and problem was that hint was empty when typing historie. So filtering commands with empty hint was returning empty choices. I added a check when hint is empty then i just resolve it with recent 8 commands. Check this out below:

screen shot 2017-07-15 at 2 40 48 pm
siddharthkp commented 7 years ago

that's what line 19 tries to do.

what is the value of choices and choices.length in your case?

hamxabaig commented 7 years ago

@siddharthkp You're right, sorry didn't see clearly. The choices has value ['']. It has one empty element therefore its not being invoked.

Apart from this, We should show recent commands first. Like the last ones first.

hamxabaig commented 7 years ago

But i think, your case will not work. What if user typed some query that didn't matched any of commands previously typed. Then i think your approach will throw all of the commands in resolve which is not correct.

hamxabaig commented 7 years ago

@siddharthkp check now, I filtered the result (choices) with truthy values. Its working now.

siddharthkp commented 7 years ago

Thanks! Published in 1.0.1