PatrickF1 / fzf.fish

🔍🐟 Fzf plugin for Fish
MIT License
1.96k stars 78 forks source link

[Search history] simplify logic into pipeline #255

Closed PatrickF1 closed 2 years ago

PatrickF1 commented 2 years ago

A small flaw with https://github.com/PatrickF1/fzf.fish/pull/252 was that it didn't preserve the boundaries between commands and so at the end, it had to check each line of output for the timestamps and remove them. Not only was that it inefficient and a little hard to understand, it could potentially result in a bug if a command ever included a line that began with "$datetimestring | ".

A better solution is to keep each command selected as an individual argument throughout the entire pipeline by delineating them with nulls, which is thankfully supported by fzf and fish string utils. Additionally, I realized the logic of stripping out the timestamps could be elegantly integrated into the pipeline.