COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/ssdiff/ssrediff.cpp
Go to the documentation of this file.
00001 
00002 #include <stdio.h>
00003 #include <coopy/Diff.h>
00004 
00005 using namespace coopy::app;
00006 using namespace std;
00007 
00008 int main(int argc, char *argv[]) {
00009   Options opt("ssrediff");
00010   int r = opt.apply(argc,argv);
00011   if (r!=0) return r;
00012 
00013   bool help = opt.checkBool("help");
00014 
00015   const vector<string>& core = opt.getCore();
00016   if (core.size()>2) {
00017     fprintf(stderr, "Options not understood\n");
00018     return 1;
00019   }
00020 
00021   if (core.size()<1||help) {
00022     opt.beginHelp();
00023     opt.addUsage("ssrediff [options] PATCHFILE");
00024     opt.addUsage("ssrediff [options] DATAFILE PATCHFILE");
00025     opt.addDescription("Reformat a tabular diff file. Converting to hilite/review formats will require supplying the original spreadsheet/database. Not every diff format supported as output by ssdiff can be read as input by ssrediff.");
00026     opt.showOptions(OPTION_FOR_REDIFF);
00027     opt.addExample("ssrediff --format sql numbers_patch.tdiff",
00028                    "Convert tdiff format file to SQL").require("_numbers_patch.tdiff");
00029     opt.addExample("ssrediff --format sql --act update numbers_patch.tdiff",
00030                    "Convert tdiff format file to SQL, showing updates only").require("_numbers_patch.tdiff");
00031     opt.addExample("ssrediff --format csv numbers_patch.tdiff",
00032                    "Convert tdiff format file to a CSV-readable diff format").require("_numbers_patch.tdiff");
00033     opt.addExample("ssrediff --format hilite --output review.csv numbers_buggy.csv numbers_patch.tdiff",
00034                    "Generate tabular form of diff for eyeballing. If ssrediff is compiled with gnumeric support, and output format is *.xls, color highlighting is added.").require("numbers_buggy.csv").require("_numbers_patch.tdiff");
00035     opt.endHelp();
00036 
00037     return help?0:1;
00038   }
00039 
00040   Diff diff;
00041   return diff.apply(opt);
00042 }
00043 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines