29 #include <ndn-cxx/util/logger.hpp>
44 os <<
"nfdc [-h|--help] [-V|--version] [-f|--batch <batch-file>] [<command> [<args>]]\n\n";
46 os <<
"All subcommands:\n";
49 os <<
"Subcommands starting with " << noun <<
":\n";
52 std::vector<const CommandDefinition*> commands = parser.
listCommands(noun, mode);
53 if (commands.empty()) {
58 for (
auto def : commands) {
59 os <<
" " << def->getNoun() <<
' ' << def->getVerb() <<
' '
61 def->getNoun().size() - def->getVerb().size() - 2)}
62 << def->getTitle() <<
'\n';
65 os <<
"\nSee 'nfdc help <command>' to read about a specific subcommand.\n";
71 const std::string manpage =
"nfdc-" + noun;
73 ::execlp(
"man",
"man", manpage.data(),
nullptr);
74 NDN_LOG_FATAL(
"Error opening man page for " << manpage <<
": " << std::strerror(errno));
80 const auto helpOpts = {
"help"sv,
"--help"sv,
"-h"sv};
81 auto it = std::find_first_of(args.begin(), args.end(), helpOpts.begin(), helpOpts.end());
86 auto noun = args.size() > 0 ? args[0] :
"";
87 auto verb = args.size() > 1 ? args[1] :
"";
Print a number of whitespaces.