X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fgimmick%2Fmain.cxx;h=b064a25829d19c22f0706e81a9681f42ddff3e6d;hb=00dbbc177a9b5db334393734151e820a65f65efc;hp=bee8ff1c269aa6b2137bbd82c9d695eaa1854764;hpb=ab4f051eca01a4340f78587f97e89eeb46a8d8a7;p=creaImageIO.git diff --git a/appli/gimmick/main.cxx b/appli/gimmick/main.cxx index bee8ff1..b064a25 100644 --- a/appli/gimmick/main.cxx +++ b/appli/gimmick/main.cxx @@ -1,5 +1,5 @@ #include - + using namespace boost; namespace po = boost::program_options; @@ -25,18 +25,21 @@ int main(int ac, char* av[]) po::options_description command("COMMANDS"); command.add_options() ("print,p","Prints the local database tree (default=off)") - ("file,f",po::value< vector >(),"Adds the file to the local database") + ("files,f",po::value< vector >(),"Adds the file(s) to the local database") ("dir,d",po::value< vector >(),"Adds the directory to the local database") - ("sync,s","Synchronizes the local database with the files") - ("recurse,r","Recurse into sub-directories (default=off)"); - + ("sync,s",po::value< vector >(),"Synchronizes the local database with the files") + ("copy,c",po::value< vector >(),"Copies the files into a local directory"); + //Describes third group of options po::options_description option("OPTIONS"); option.add_options() ("verbose,v",po::value(&verb),"Verbosity level (default=`1')") - ("debug,D",po::value(&deb),"Debug messages level (default=`0')"); - - + ("debug,D",po::value(&deb),"Debug messages level (default=`0')") + ("recurse,r","Recurse into sub-directories (default=off)") + ("repair,R","Repair the database (on synchronization) (default=off)") + ("check,C","Check for attribute differences (on synchronization) (default=off)") + ("handler,H",po::value(&handler),"Handler name (default=`Local database')"); + //Adds the groups into a big one po::options_description cmdline_options; cmdline_options.add(generic).add(command).add(option); @@ -46,6 +49,7 @@ int main(int ac, char* av[]) po::store(po::parse_command_line(ac, av, cmdline_options), vm); po::notify(vm); + //Does something on each option //GENERIC if (vm.count("help")) { @@ -71,7 +75,9 @@ int main(int ac, char* av[]) ||vm.count("file") ||vm.count("dir") ||vm.count("sync") + ||vm.count("copy") ) + { try { @@ -86,17 +92,36 @@ int main(int ac, char* av[]) } if (vm.count("dir")) { std::vector dirs=vm["dir"].as< vector >(); - g.AddDir(handler,dirs.front(), vm.count("recurse")); + bool recu=false; + std::stringstream out; + out< name=vm["sync"].as< vector >(); + std::stringstream out; + out< name=vm["copy"].as< vector >(); + g.CopyFiles(name,handler); + } g.Finalize(); } catch (crea::Exception e) { e.Print(); } + } + return 0; }