added commandline option: help message, version message and usage displayed when insufficient arguments

This commit is contained in:
Phitherek 2012-09-14 18:32:44 +02:00
parent 206971dfa2
commit 36d537faa1

19
3m.cpp
View File

@ -430,6 +430,23 @@ sconfig << homedir << "/.3m/config";
config = sconfig.str();
int ps;
string localrepo, localml, localri;
if(argc < 2) {
cout << "3m - Minetest Mod Manager v. 0.1-indev (C) 2012 by Phitherek_" << endl;
cout << "Usage: " << argv[0] << "[-S/I/R/Q/h/v] [options] modname1 modname2 ..." << endl;
} else {
if(argv[1] == "-h") {
cout << "3m - Minetest Mod Manager v. 0.1-indev (C) 2012 by Phitherek_" << endl;
cout << "Usage: " << argv[0] << "[-S/I/R/Q/h/v] [options] modname1 modname2 ..." << endl;
cout << endl;
cout << "-S - Sync: gather information from remote modinfo files and update local modlist" << endl;
cout << "-I - Install: download and install mod(s)" << endl;
cout << "-R - Remove: remove installed mod(s)" << endl;
cout << "-Q - Query: Query local modlist for a modname(s)" << endl;
cout << "-h - Help: This message" << endl;
cout << "-v - Version: Print version" << endl;
} else if(argv[1] == "-v") {
cout << "3m - Minetest Mod Manager v. 0.1-indev (C) 2012 by Phitherek_" << endl;
} else {
ps = parseconfig(&localrepo, &localml, &localri, config);
if(ps == 1) {
cerr << "Parse error! Exiting..." << endl;
@ -443,3 +460,5 @@ cout << "DEBUG: localri: " << localri << endl;
//---DEBUG END---
return EXIT_SUCCESS;
}
}
}