- Timestamp:
- Jun 6, 2010, 5:10:43 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/svndigest.cc
r1068 r1069 31 31 #include "main_utility.h" 32 32 #include "rmdirhier.h" 33 #include <sstream> 33 34 #include "Stats.h" 34 35 #include "StatsCollection.h" … … 50 51 #include <unistd.h> 51 52 53 using namespace theplu; 54 using namespace svndigest; 55 void copy_option2config(const svndigestParameter&, Configuration&); 56 52 57 void create_file_struct(std::string stats_type, 53 58 const theplu::svndigest::Stats& stats); … … 55 60 int main( int argc, char* argv[]) 56 61 { 57 using namespace theplu;58 using namespace svndigest;59 62 60 63 // Reading commandline options … … 72 75 try { 73 76 load_config(option.config_file()); 77 copy_option2config(option, Configuration::instance()); 74 78 } 75 79 catch (std::runtime_error& e) { … … 81 85 Configuration& config = Configuration::instance(); 82 86 // set values from commandline into config object 83 try {84 if (option.format().present())85 Configuration::instance().image_format(option.format().value());86 }87 catch (std::runtime_error& e) {88 std::cerr << PACKAGE_NAME ": invalid argument `"89 << option.format().value() << "' for `--"90 << option.format().long_name() << "'\n"91 << e.what() << "\n"92 << "Try `" << PACKAGE_NAME << " --help' for more information.\n";93 exit(EXIT_FAILURE);94 }95 try {96 if (option.anchor_format().present())97 config.image_anchor_format(option.anchor_format().value());98 }99 catch (std::runtime_error& e) {100 std::cerr << PACKAGE_NAME ": invalid argument `"101 << option.anchor_format().value() << "' for `--"102 << option.anchor_format().long_name() << "'\n"103 << e.what() << "\n"104 << "Try `" << PACKAGE_NAME << " --help' for more information.\n";105 exit(EXIT_FAILURE);106 }107 108 87 // write configuration 109 88 if (option.generate_config()) { … … 244 223 exit(EXIT_SUCCESS); // normal exit 245 224 } 225 226 227 void copy_option2config(const svndigestParameter& option, Configuration& config) 228 { 229 try { 230 if (option.format().present()) 231 Configuration::instance().image_format(option.format().value()); 232 } 233 catch (std::runtime_error& e) { 234 std::stringstream ss; 235 ss << "invalid argument `" 236 << option.format().value() << "' for `--" 237 << option.format().long_name() << "'\n" 238 << e.what() << "\n" 239 << "Try `svndigest --help' for more information.\n"; 240 throw std::runtime_error(ss.str()); 241 } 242 try { 243 if (option.anchor_format().present()) 244 config.image_anchor_format(option.anchor_format().value()); 245 } 246 catch (std::runtime_error& e) { 247 std::stringstream ss; 248 ss << "invalid argument `" 249 << option.anchor_format().value() << "' for `--" 250 << option.anchor_format().long_name() << "'\n" 251 << e.what() << "\n" 252 << "Try `svndigest --help' for more information.\n"; 253 throw std::runtime_error(ss.str()); 254 } 255 } 256 246 257 247 258 void create_file_struct(std::string stats_type,
Note: See TracChangeset
for help on using the changeset viewer.