Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / compiler / tfl-verify / src / Driver.cpp
index 81f6d54..6d18976 100644 (file)
 
 #include "VerifyFlatBuffers.h"
 
+#include <arser/arser.h>
+
 #include <iostream>
 #include <memory>
 #include <string>
 
 int entry(int argc, char **argv)
 {
-  if (argc != 2)
+  arser::Arser arser;
+  arser.add_argument("tflite").type(arser::DataType::STR).help("TFLite file path to verify");
+
+  try
   {
-    std::cerr << "ERROR: Failed to parse arguments" << std::endl;
-    std::cerr << std::endl;
-    std::cerr << "USAGE: " << argv[0] << " [tflite]" << std::endl;
+    arser.parse(argc, argv);
+  }
+  catch (const std::runtime_error &err)
+  {
+    std::cout << err.what() << std::endl;
+    std::cout << arser;
     return 255;
   }
+
   auto verifier = std::make_unique<VerifyFlatbuffers>();
 
-  std::string model_file = argv[argc - 1];
+  std::string model_file = arser.get<std::string>("tflite");
 
   std::cout << "[ RUN       ] Check " << model_file << std::endl;