[Search history] simplify logic into pipeline #255
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A small flaw with #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.