tools: nfdc status commands
These commands are added to nfdc:
status show
face list
channel list
strategy list
fib list
route list
They are implemented by calling into legacy nfd-status procedures,
and currently do not support filtering arguments.
Future commits will re-implement them directly with StatusReport.
refs #3749
Change-Id: I11f3f074966649c3732969ffa22f9b3938bb4bac
This commit is contained in:
1 parent
bf6acd5cc9
commit
3d1eb091c0
1 file changed
+26
@@ -46,6 +46,12 @@ statusReport(ExecuteContext& ctx)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
statusList(ExecuteContext& ctx, const std::string& option)
|
||||
{
|
||||
return statusMain(std::vector<std::string>{option}, ctx.face, ctx.keyChain);
|
||||
}
|
||||
|
||||
static int
|
||||
legacyNfdStatus(ExecuteContext& ctx)
|
||||
{
|
||||
@@ -61,6 +67,26 @@ registerCommands(CommandParser& parser)
|
||||
.addArg("format", ArgValueType::REPORT_FORMAT, Required::NO, Positional::YES);
|
||||
parser.addCommand(defStatusReport, &statusReport);
|
||||
|
||||
struct StatusCommandDefinition
|
||||
{
|
||||
std::string noun;
|
||||
std::string verb;
|
||||
std::string legacyOption;
|
||||
};
|
||||
const std::vector<StatusCommandDefinition> statusCommands{
|
||||
{"status", "show", "-v"},
|
||||
{"face", "list", "-f"},
|
||||
{"channel", "list", "-c"},
|
||||
{"strategy", "list", "-s"},
|
||||
{"fib", "list", "-b"},
|
||||
{"route", "list", "-r"}
|
||||
};
|
||||
for (const StatusCommandDefinition& scd : statusCommands) {
|
||||
CommandDefinition def(scd.noun, scd.verb);
|
||||
parser.addCommand(def, bind(&statusList, _1, scd.legacyOption));
|
||||
}
|
||||
parser.addAlias("status", "show", "list");
|
||||
|
||||
CommandDefinition defLegacyNfdStatus("legacy-nfd-status", "");
|
||||
defLegacyNfdStatus
|
||||
.addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
|
||||
|
||||
Reference in new issue
Block a user