The idea is to make the history file more readable for humans, but also easily importable by other tools.
I don't think there's a library for handling CSV files in Bash, and even if there was, I think it would slow down things a lot, which we don't want because shellhistory
happens in interactive shells and we cannot let users wait for more than 200ms between each command. Appending a line to the history file must be as fast as possible.
But the CSV formatting is not hard either, so we could do it by hand. If I remember correctly, you can use any delimiter you want, as long as fields that contain it are enclosed in double-quotes. If these same fields also contain double-quotes, then you must simply double these.
Example with a comma as delimiter:
field 1,,field 3,"hey, I'm field 4!",,"he said ""4""? alright, then I'm gonna say ""6""!",field 7
Same string imported in GNumeric:
It's working, yay!
So instead of encoding parents and working directory in base 64, we could simply enclose them in double-quotes, and use some sed 's/"/""/g
on it. And instead of prepending a colon on normal lines, and a semi-colon on extra command lines, we could also simply do the same for the command.
:...:echo "a
;b
;c" | wc -c
would become
...:"echo ""a
b
c"" | wc -c"
Also, just to make sure, we could also enclose hostname and user in double-quotes.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too