- Timestamp:
- Jun 30, 2009, 5:57:27 AM (14 years ago)
- Location:
- trunk/bin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/Makefile.am
r768 r795 29 29 noinst_HEADERS = Parameter.h 30 30 31 LDADD = $(top_builddir)/lib/libsvndigest.a $(SVNDIGEST_LIBS) 31 LDADD = $(top_builddir)/lib/libsvndigest.a \ 32 $(top_builddir)/lib/yat/libyat.a $(SVNDIGEST_LIBS) 32 33 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) 33 34 -
trunk/bin/Parameter.cc
r752 r795 22 22 #include "Parameter.h" 23 23 24 #include "ColumnStream.h"25 #include "OptionArg.h"26 #include "OptionHelp.h"27 #include "OptionSwitch.h"28 24 #include "OptionVersion.h" 29 #include "utility.h" 25 #include "../lib/utility.h" // to avoid inclusion of yat file 26 27 #include "yat/ColumnStream.h" 28 #include "yat/Exception.h" 29 #include "yat/OptionArg.h" 30 #include "yat/OptionHelp.h" 31 #include "yat/OptionSwitch.h" 32 30 33 #include <config.h> // this header file is created by configure 31 34 … … 52 55 cmd_.parse(argc, argv); 53 56 } 54 catch ( cmd_error& e) {57 catch (yat::utility::cmd_error& e) { 55 58 std::cerr << e.what() << std::endl; 56 59 exit (-1); … … 101 104 ss << "svndigest: cannot read `" << root_->value() << "': " 102 105 << strerror(errno); 103 throw cmd_error(ss.str());106 throw yat::utility::cmd_error(ss.str()); 104 107 } 105 108 root_->value(pwd()); … … 116 119 ss << "svndigest: cannot create directory `" << path 117 120 << "': " << strerror(errno); 118 throw cmd_error(ss.str());121 throw yat::utility::cmd_error(ss.str()); 119 122 } 120 123 if (node_exist(path) && !force()) { … … 122 125 ss << "svndigest: cannot create directory `" << path << "' " 123 126 << strerror(EEXIST); 124 throw cmd_error(ss.str());127 throw yat::utility::cmd_error(ss.str()); 125 128 } 126 129 if (chdir(target_->value().c_str())) { … … 128 131 ss << "svndigest: cannot read `" << target_->value() << "': " 129 132 << strerror(errno); 130 throw cmd_error(ss.str());133 throw yat::utility::cmd_error(ss.str()); 131 134 } 132 135 target_->value(pwd()); … … 151 154 ss << "svndigest: `" << config_file_->value() 152 155 << "' is not a regular file"; 153 throw cmd_error(ss.str());156 throw yat::utility::cmd_error(ss.str()); 154 157 } 155 158 } … … 163 166 std::stringstream ss; 164 167 ss << "svndigest: cannot stat `" << path << "': " << strerror(errno); 165 throw cmd_error(ss.str());168 throw yat::utility::cmd_error(ss.str()); 166 169 } 167 170 … … 173 176 std::stringstream ss; 174 177 ss << "svndigest: cannot open `" << path << "': " << strerror(errno); 175 throw cmd_error(ss.str());178 throw yat::utility::cmd_error(ss.str()); 176 179 } 177 180 … … 211 214 // don't use argv[0] because user may rename the binary 212 215 cmd_.program_name() = PACKAGE_NAME; 213 config_file_=new OptionArg<std::string>(cmd_, "config-file",216 config_file_=new yat::utility::OptionArg<std::string>(cmd_, "config-file", 214 217 "configuration file [<ROOT>/.svndigest/config]"); 215 218 config_file_->print_arg("=FILE"); 216 219 std::stringstream ss; 217 copyright_ = new OptionSwitch(cmd_, "copyright",220 copyright_ = new yat::utility::OptionSwitch(cmd_, "copyright", 218 221 "update copyright statement"); 219 222 220 223 ss << "if sub-directory named <ROOT> exists in target directory, remove " 221 224 << "sub-directory before writing results"; 222 force_ = new OptionSwitch(cmd_, "f,force", ss.str());223 ss.str(""); 224 225 help_ = new OptionHelp(cmd_);225 force_ = new yat::utility::OptionSwitch(cmd_, "f,force", ss.str()); 226 ss.str(""); 227 228 help_ = new yat::utility::OptionHelp(cmd_); 226 229 generate_config_ = 227 new OptionSwitch(cmd_, "g,generate-config",230 new yat::utility::OptionSwitch(cmd_, "g,generate-config", 228 231 "write configuration file to standard output"); 229 232 230 233 ss.str(""); 231 234 ss << "ignore cache files and analyze everything from repository"; 232 ignore_cache_ = new OptionSwitch(cmd_, "ignore-cache", ss.str());235 ignore_cache_ = new yat::utility::OptionSwitch(cmd_, "ignore-cache", ss.str()); 233 236 234 report_ = new OptionSwitch(cmd_, "report", "create no HTML report", true);237 report_ = new yat::utility::OptionSwitch(cmd_, "report", "create no HTML report", true); 235 238 236 239 ss.str(""); 237 240 ss << "use revision numbers as time scale instead of dates [dates]"; 238 revisions_ = new OptionSwitch(cmd_, "revisions", ss.str());241 revisions_ = new yat::utility::OptionSwitch(cmd_, "revisions", ss.str()); 239 242 240 243 root_= 241 new OptionArg<std::string>(cmd_, "r,root",244 new yat::utility::OptionArg<std::string>(cmd_, "r,root", 242 245 "svn controlled directory to perform statistics on [.]"); 243 246 root_->print_arg("=ROOT"); 244 target_ = new OptionArg<std::string>(cmd_, "t,target",247 target_ = new yat::utility::OptionArg<std::string>(cmd_, "t,target", 245 248 "output directory [.]"); 246 249 target_->print_arg("=TARGET"); 247 250 248 verbose_ = new OptionSwitch(cmd_, "v,verbose", "explain what is being done");251 verbose_ = new yat::utility::OptionSwitch(cmd_, "v,verbose", "explain what is being done"); 249 252 version_ = new OptionVersion(cmd_, "version", 250 253 "print version information and exit", verbose_); -
trunk/bin/Parameter.h
r768 r795 24 24 */ 25 25 26 #include " CommandLine.h"27 #include " OptionArg.h"26 #include "yat/CommandLine.h" 27 #include "yat/OptionArg.h" 28 28 29 29 #include <string> 30 30 31 31 namespace theplu { 32 namespace yat { 33 namespace utility { 34 class OptionHelp; 35 class OptionSwitch; 36 }} 32 37 namespace svndigest { 33 38 34 class OptionHelp;35 class OptionSwitch;36 39 class OptionVersion; 37 40 … … 66 69 void init(void); 67 70 68 CommandLine cmd_;69 OptionArg<std::string>* config_file_;70 OptionSwitch* copyright_;71 OptionSwitch* force_;72 OptionSwitch* generate_config_;73 OptionHelp* help_;74 OptionSwitch* ignore_cache_;75 OptionSwitch* report_;76 OptionSwitch* revisions_;77 OptionArg<std::string>* root_;78 OptionArg<std::string>* target_;79 OptionSwitch* verbose_;71 yat::utility::CommandLine cmd_; 72 yat::utility::OptionArg<std::string>* config_file_; 73 yat::utility::OptionSwitch* copyright_; 74 yat::utility::OptionSwitch* force_; 75 yat::utility::OptionSwitch* generate_config_; 76 yat::utility::OptionHelp* help_; 77 yat::utility::OptionSwitch* ignore_cache_; 78 yat::utility::OptionSwitch* report_; 79 yat::utility::OptionSwitch* revisions_; 80 yat::utility::OptionArg<std::string>* root_; 81 yat::utility::OptionArg<std::string>* target_; 82 yat::utility::OptionSwitch* verbose_; 80 83 OptionVersion* version_; 81 84 -
trunk/bin/svndigest.cc
r763 r795 26 26 #include "css.h" 27 27 #include "Directory.h" 28 #include "Exception.h"29 28 #include "first_page.h" 30 29 #include "GnuplotFE.h" … … 36 35 #include "SVNinfo.h" 37 36 #include "SVNlog.h" 38 #include "utility.h" 37 #include "../lib/utility.h" 38 39 #include "yat/Exception.h" 39 40 40 41 #include <cassert> … … 51 52 int main( int argc, char* argv[]) 52 53 { 53 using namespace theplu::svndigest; 54 using namespace theplu; 55 using namespace svndigest; 54 56 55 57 // Reading commandline options … … 60 62 std::cout << "Done parsing parameters" << std::endl; 61 63 } 62 catch ( cmd_error& e) {64 catch (yat::utility::cmd_error& e) { 63 65 std::cerr << e.what() << std::endl; 64 66 exit(-1);
Note: See TracChangeset
for help on using the changeset viewer.