#include <creaImageIOGimmick.h>
+#include <creaMessageManager.h>
+#include <gimmick_ggo.h>
+
int main(int argc, char* argv[])
{
+
+ gengetopt_args_info args;
+ if (cmdline_parser (argc, argv, &args) != 0) return 0 ;
+
creaImageIO::Gimmick g;
- if (!g.Initialize()) return 1;
- if (!g.Finalize()) return 1;
+ if (args.verbose_given) g.SetMessageLevel(args.verbose_arg);
+ if (args.debug_given) g.SetDebugMessageLevel(args.debug_arg);
+
+ bool something_to_do =
+ args.dir_given |
+ args.file_given |
+ args.print_given;
+
+ if (!something_to_do)
+ {
+ std::cout << "Nothing to do !" << std::endl;
+ return 0;
+ }
+
+ std::string handler("Local database");
+ try
+ {
+ g.Initialize();
+
+ if (args.file_given)
+ {
+ std::vector<std::string> files;
+ // TO DO : multiple files given
+ files.push_back(args.file_arg);
+ g.AddFiles(handler,files);
+ }
+ if (args.dir_given)
+ {
+ g.AddDir(handler,args.dir_arg, args.recurse_given);
+ }
+
+ if (args.print_given)
+ {
+ g.GetTreeHandler(handler)->LoadChildren(0,0);
+ g.Print(handler);
+ }
+
+ g.Finalize();
+ }
+ catch (crea::Exception e)
+ {
+ e.Print();
+ }
+
return 0;
}