equal
deleted
inserted
replaced
97 } |
97 } |
98 } |
98 } |
99 |
99 |
100 str << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS] [ARGUMENTS]" |
100 str << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS] [ARGUMENTS]" |
101 << endl << endl |
101 << endl << endl |
102 << "Commands (can be abbreviated):" << endl; |
102 << "Commands (can be abbreviated):" << endl; |
103 |
103 |
104 str << left; |
104 str << left; |
105 for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
105 for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
106 str << " " << setw(maxWidth) << (*ci)->getName() |
106 str << " " << setw(maxWidth) << (*ci)->getName() |
107 << " " << (*ci)->getBriefDescription() << endl; |
107 << " " << (*ci)->getBriefDescription() << endl; |
108 } |
108 } |
109 |
109 |
110 str << endl |
110 str << endl |
111 << "Global options:" << endl |
111 << "Global options:" << endl |
112 << " --master -m <master> Index of the master to use. Default: 0." |
112 << " --master -m <master> Index of the master to use. Default: 0." |
113 << endl |
113 << endl |
114 << " --force -f Force a command." << endl |
114 << " --force -f Force a command." << endl |
115 << " --quiet -q Output less information." << endl |
115 << " --quiet -q Output less information." << endl |
116 << " --verbose -v Output more information." << endl |
116 << " --verbose -v Output more information." << endl |
117 << " --help -h Show this help." << endl |
117 << " --help -h Show this help." << endl |
118 << endl |
118 << endl |
237 break; |
237 break; |
238 } |
238 } |
239 } |
239 } |
240 while (c != -1); |
240 while (c != -1); |
241 |
241 |
242 argCount = argc - optind; |
242 argCount = argc - optind; |
243 |
243 |
244 if (!argCount) { |
244 if (!argCount) { |
245 if (helpRequested) { |
245 if (helpRequested) { |
246 cout << usage(); |
246 cout << usage(); |
247 exit(0); |
247 exit(0); |
248 } else { |
248 } else { |
249 cerr << "Please specify a command!" << endl |
249 cerr << "Please specify a command!" << endl |
250 << endl << usage(); |
250 << endl << usage(); |
251 exit(1); |
251 exit(1); |
252 } |
252 } |
253 } |
253 } |
254 |
254 |
255 commandName = argv[optind]; |
255 commandName = argv[optind]; |
256 while (++optind < argc) |
256 while (++optind < argc) |
257 commandArgs.push_back(string(argv[optind])); |
257 commandArgs.push_back(string(argv[optind])); |
258 } |
258 } |
318 commandList.push_back(new CommandStates()); |
318 commandList.push_back(new CommandStates()); |
319 commandList.push_back(new CommandUpload()); |
319 commandList.push_back(new CommandUpload()); |
320 commandList.push_back(new CommandVersion()); |
320 commandList.push_back(new CommandVersion()); |
321 commandList.push_back(new CommandXml()); |
321 commandList.push_back(new CommandXml()); |
322 |
322 |
323 getOptions(argc, argv); |
323 getOptions(argc, argv); |
324 |
324 |
325 matchingCommands = getMatchingCommands(commandName); |
325 matchingCommands = getMatchingCommands(commandName); |
326 masterDev.setIndex(masterIndex); |
326 masterDev.setIndex(masterIndex); |
327 |
327 |
328 if (matchingCommands.size()) { |
328 if (matchingCommands.size()) { |
366 cerr << "Unknown command " << commandName << "!" << endl |
366 cerr << "Unknown command " << commandName << "!" << endl |
367 << endl << usage(); |
367 << endl << usage(); |
368 retval = 1; |
368 retval = 1; |
369 } |
369 } |
370 |
370 |
371 return retval; |
371 return retval; |
372 } |
372 } |
373 |
373 |
374 /****************************************************************************/ |
374 /****************************************************************************/ |