You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Boost priority
Boost priority in our backlog through Polar.sh. Higher pledge, higher priority.
Minimum pledge by user/organization is $5, minimum amount for boost is $30.
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:
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.would become
Also, just to make sure, we could also enclose hostname and user in double-quotes.
Boost priority
The text was updated successfully, but these errors were encountered: