siddharthkp / historie

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

Doesn't work with Aliases #1

Closed josephrexme closed 7 years ago

josephrexme commented 7 years ago

When historie suggests an alias then you go ahead to type that it gives command not found if it's an alias

siddharthkp commented 7 years ago

Hey, nice catch!

historie uses sindresorhus/execa

I'm not sure how can I make aliases work with that. This might be helpful: https://github.com/sindresorhus/execa#shell

josephrexme commented 7 years ago

If only it were only bash users using this we'd only have to change the command of execa to bash -i. I can't find a shell agnostic way of looking in the startup configuration and being aware of aliases

siddharthkp commented 7 years ago

Related: https://github.com/sindresorhus/execa/issues/100

josephrexme commented 7 years ago

As @sindresorhus mentioned in that issue you'd have to spawn it through an interactive shell. which is what I suggested with bash -i but the goal is to make this shell agnostic hence why POSIX sh is the default of execa, so it might be difficult to achieve that. What I'd suggest is that you don't try to run the command at all with historie. Check out how fzf handles this. When you run a command like vim ** it stdout the file name after providing you with suggestions. It doesn't run the command for you. Perhaps by doing this we'd escalate this problem.

I also tried this in ruby using carets to exec shell code and it couldn't expand aliases so I'll be closing this and hopefully we can just stdout the result of matching command rather than trying to run it from within historie