I am writing a console application which is rapidly gaining many command line arguments and flags. For this reason I want the user to be able to access a description of these flags and what purpose they serve.
There are several possible solutions I can think of
I could stick the whole message in a variable inside my program and print this to the screen when the user types mycmd --help
or something similar. Advantages, stays with executable and not editable, disadvantage is in code since I would have something like that below floating around.
const char[] helpmsg = "Line1\n"
"Line2\n"
"...\n"
"LineN\n";
I could write a man
entry for my program but this isn't very portable as the application will be used pretty equally on Windows and Linux.
I'm aware the question is probably a matter of taste but I was just curious if there are any other solutions which I haven't thought of that people have used in the past.
Ideally it would be something which is easy for the developer (at the moment me) to edit and keep updated but where others cannot really mess with it.
Consider using the boost program options library.