They are mostly visual separators for different parts of a single function. ... make clean to the reader which lines of code inside a function are closely related and which are not.
Your first function listed, the constructor, doesn't need such "visual separators" other than a blank line. The closely-related lines come in pairs, one for the real ...
Your comment to my main answer states:
The problem with string_view is that I have to provide a null-terminated [sic] string to Linux API, but string_view doesn't support .c_str() so I have to create a temporary std::string each time.
Here's my code for dealing with that.
/* Sometmimes we need a nul-terminated const char*, such as for ...
So what do you think about this commenting style?
It encourages meandering functions, and does not help make sure each "clump" is cohesive. You lose the exit pathway, where you can return when you have the answer as the function is a strong boundary with special semantics; if it's just a clump of lines, that's a goto to jump out of the clump. ...
Your code currently suffers from Leaning Toothpick Syndrome. The directory separator backslash \ in Windows paths needs to be escaped in strings (\\) to avoid being mistaken for an escape sequence like \n, \r, \t, or \x. A similar problem happens with regular expressions, which use the backslash to introduce terms like whitespace (\s).
It's generally a very bad idea to put credentials in a program. That's
a bigger topic, and the best approach will vary depending on your situation.
But you should address this problem.
When naming things, let ordinary English usage guide you: plural for
collections (lists, tuples, dicts, etc) and singular for individual values. For
example, use files and ...
When you use conditional code make it functional so the code you read looks normal. i.e. don't mess up the code by putting conditional compilation in. Use conditional compilation to generate alternative versions of appropriate functions.
static void color_green(std::string path)
//color code for green
std::cout << "$ ";
if (cmnd == "exit")
A few comments here:
You output a prompt, "$ ", but you only do that once. The other ...