ndnpeek: replace --link-file with --fwhint

refs #4207, #5187

Change-Id: I8213e971520d3edab631634a03bf7950d265dc11
diff --git a/tools/peek/ndnpeek/main.cpp b/tools/peek/ndnpeek/main.cpp
index ff9f2af..22523b7 100644
--- a/tools/peek/ndnpeek/main.cpp
+++ b/tools/peek/ndnpeek/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,7 @@
  */
 
 #include "ndnpeek.hpp"
+#include "core/program-options-ext.hpp"
 #include "core/version.hpp"
 
 #include <ndn-cxx/util/io.hpp>
@@ -85,7 +86,8 @@
   interestOptDesc.add_options()
     ("prefix,P",   po::bool_switch(&options.canBePrefix), "set CanBePrefix")
     ("fresh,f",    po::bool_switch(&options.mustBeFresh), "set MustBeFresh")
-    ("link-file",  po::value<std::string>(), "set ForwardingHint from a raw binary file")
+    ("fwhint,F",   po::value<std::vector<Name>>(&options.forwardingHint)->composing(),
+                   "add ForwardingHint delegation name")
     ("lifetime,l", po::value<time::milliseconds::rep>()->default_value(options.interestLifetime.count()),
                    "set InterestLifetime, in milliseconds")
     ("hop-limit,H",     po::value<int>(), "set HopLimit")
@@ -98,7 +100,7 @@
 
   po::options_description hiddenOptDesc;
   hiddenOptDesc.add_options()
-    ("name", po::value<std::string>(), "Interest name");
+    ("name", po::value<Name>(&options.name), "Interest name");
 
   po::options_description optDesc;
   optDesc.add(visibleOptDesc).add(hiddenOptDesc);
@@ -132,14 +134,6 @@
     return 2;
   }
 
-  try {
-    options.name = vm["name"].as<std::string>();
-  }
-  catch (const Name::Error& e) {
-    std::cerr << "ERROR: invalid name: " << e.what() << std::endl;
-    return 2;
-  }
-
   if (vm.count("timeout") > 0) {
     options.timeout = time::milliseconds(vm["timeout"].as<time::milliseconds::rep>());
     if (*options.timeout < 0_ms) {
@@ -148,19 +142,6 @@
     }
   }
 
-  if (vm.count("link-file") > 0) {
-    auto filename = vm["link-file"].as<std::string>();
-    std::ifstream linkFile = openBinaryFile(filename);
-    if (!linkFile) {
-      return 2;
-    }
-    options.link = io::load<Link>(linkFile, io::NO_ENCODING);
-    if (!options.link) {
-      std::cerr << "ERROR: cannot parse a valid Link object from file '" << filename << "'" << std::endl;
-      return 2;
-    }
-  }
-
   options.interestLifetime = time::milliseconds(vm["lifetime"].as<time::milliseconds::rep>());
   if (options.interestLifetime < 0_ms) {
     std::cerr << "ERROR: InterestLifetime cannot be negative" << std::endl;