31 #include <QCoreApplication>
32 #include <QStringList>
33 #include "arcspackagemanager.h"
165 Mode currentMode = NONE;
166 bool storeSettings=
false;
171 std::cout <<
" Usage: " << prgname <<
" -b|-i packageName|-I|-h [-s] [-Dsetting=value]" << std::endl;
172 std::cout <<
" -h: prints this help message and current settings" << std::endl;
173 std::cout <<
" -b: build a repository" << std::endl;
174 std::cout <<
" -i: install packageName" << std::endl;
175 std::cout <<
" -I: install all packages from repository" << std::endl;
176 std::cout <<
" -s: store settings" << std::endl;
177 std::cout <<
" -D: defines a setting with a value" << std::endl;
179 apm.displaySettings();
182 QString readNext(
int& idx,
int argc,
char* argv[])
187 return QString::null;
193 if (!apm.hasSetting(paramName))
195 std::cout << qPrintable(message);
198 apm.setSetting(paramName,rp.data());
207 for(i=1; i < argc; i++)
209 QString current(argv[i]);
214 requestParameter(apm,
"repositoryPath",
"Please give a path for repository: ");
219 if ((next = readNext(i,argc,argv)).isEmpty())
221 std::cout <<
"packageName not given" << std::endl << std::endl;
225 currentMode = INSTALL;
227 requestParameter(apm,
"repositoryUrl",
"Please give a url for repository: ");
240 currentMode = INSTALL_ALL;
241 requestParameter(apm,
"repositoryUrl",
"Please give a url for repository: ");
242 requestParameter(apm,
"repositoryFile",
"Please give a repository file name: ");
252 if (current.startsWith(
"-D"))
254 QString set=current.remove(0,2);
255 QStringList sp = set.split(
'=');
256 apm.setSetting(sp[0],sp[1]);
267 int main(
int argc,
char* argv[])
269 QCoreApplication app(argc,argv);
270 QCoreApplication::setApplicationName(
"ARCS");
271 QCoreApplication::setOrganizationName(
"UEVE - Ibisc - IRA2 Team");
272 QCoreApplication::setOrganizationDomain(
"ibisc.fr");
281 if (!apm.checkSettings())
284 parseOptions(apm,argc,argv);
286 if (currentMode == BUILD)
288 if (currentMode == INSTALL)
289 apm.installLibrary(libName);
290 if (currentMode == INSTALL_ALL)