Closed luckasRanarison closed 9 months ago
Thanks for the fix! I’ll check it later
Oh, wait I think changing the Regex would be a better solution
Update: Why did you capture the newline in
(?:[^#\n]|\n)
? This could also cause an empty command.
static ref RE_BASH_HISTORY: Regex = Regex::new(r"(\d+)\n((?:[^#\n]|\n)+)").unwrap();
Maybe another approach is to refactor the Command::parse_line() function rather than modifying the regex parser's result? The Command::parse() function should be modified to verify if the line of command is empty or contains a valid command, such as combined commands like echo something &&
🤔 the new regex expression works for the empty line, too. But the Command::parse_line() function should also be fixed to handle the empty command in the filled line of combined commands or lines that are filled but not contain an invalid command.
Update: Why did you capture the newline in (?:[^#\n]|\n)? This could also cause an empty command.
I'm really sorry, but I'm struggling with my finals right now and might not be able to get back to you until Thursday :(
I'm really sorry, but I'm struggling with my finals right now and might not be able to get back to you until Thursday :(
There's no hurry :)
By the way, could I try adding atuin support if you haven't started yet and if you want...
By the way, could I try adding atuin support if you haven't started yet and if you want..
Absolutely! I haven't started yet and your contribution would be much appreciated if you're interested. 🙌
I added some code to improve error handling and condition restrictions for Command::parse_line(), which also help to avoid empty command stats. Now everything looks good to me! Thanks for the fix and sorry for being a little bit late to review it :(
Update: Why did you capture the newline in (?:[^#\n]|\n)? This could also cause an empty command.
This wounldn't cause the empty command stats, but it is indeed implemented not very elegantly :thinking: I will submit a PR later to fix it.
Closes #7.