add Help option

This commit is contained in:
intelligide 2015-07-03 18:31:48 +02:00
parent ae1763a3e4
commit 1899af32bc
1 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,15 @@
using namespace std;
string getHelpString(){
return "\nUsage : mkg1m input-file [OPTION]\n\n"
" -o output\t\tWrite output to file.\n"
" -l lib\t\tSearch the library named library.\n"
" -L dir\t\tadd all the libraries in the folder dir.\n"
" -v\t\t\tShow version then exit\n"
" -h\t\t\tShow help then exit\n";
}
string getVersionString(){
string str;
@ -70,6 +79,9 @@ int main(int argc,char *argv[])
case 'v':
cout << getVersionString();
return 0;
case 'h':
cout << getHelpString();
return 0;
case '?':
if (optopt == 'o')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);