]> Creatis software - creaImageIO.git/blobdiff - appli/gimmick/main.cxx
Added local copy functionality.
[creaImageIO.git] / appli / gimmick / main.cxx
index ab08f622a10ec27ea2bcfb5816233eb8531bf878..b064a25829d19c22f0706e81a9681f42ddff3e6d 100644 (file)
@@ -25,19 +25,20 @@ 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<string> >(),"Adds the file to the local database")
+    ("files,f",po::value< vector<string> >(),"Adds the file(s) to the local database")
     ("dir,d",po::value< vector<string> >(),"Adds the directory to the local database")
     ("sync,s",po::value< vector<string> >(),"Synchronizes the local database with the files")
-    ("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)");
+       ("copy,c",po::value< vector<string> >(),"Copies the files into a local directory");
 
-  
   //Describes third group of options
   po::options_description option("OPTIONS");
   option.add_options()
     ("verbose,v",po::value<int>(&verb),"Verbosity level (default=`1')")
-    ("debug,D",po::value<int>(&deb),"Debug messages level (default=`0')");
+    ("debug,D",po::value<int>(&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<string>(&handler),"Handler name (default=`Local database')");
  
   //Adds the groups into a big one
   po::options_description cmdline_options;
@@ -48,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")) {
@@ -73,7 +75,9 @@ int main(int ac, char* av[])
        ||vm.count("file")
        ||vm.count("dir")
        ||vm.count("sync")
+       ||vm.count("copy")
        )
+  {
 
     try
       {
@@ -106,12 +110,17 @@ int main(int ac, char* av[])
          if(out2.str().compare("1")==0){chk=true;}
          cout<<g.Synchronize(name.front(),rep,chk)<<"\n";
        }       
+       if (vm.count("copy")) {
+         std::vector<std::string> name=vm["copy"].as< vector<string> >();
+         g.CopyFiles(name,handler);
+       }
        g.Finalize();
       }
     catch (crea::Exception e)
       {
        e.Print();
       }
+  }
          
   
   return 0;