tools: deprecate nfdc create and nfdc destroy

They are deprecated in favor of nfdc face create and nfdc face destroy.

There is also a minor correction to nfdc-face man page.

refs #3864

Change-Id: I038bc604304ac5650101ee2afe30753e59061632
This commit is contained in:
Junxiao Shi
2017-02-20 03:34:48 +00:00
parent 26cbdbd904
commit d695801754
4 changed files with 23 additions and 13 deletions
+2 -2
View File
@@ -4,9 +4,9 @@ nfdc-face
SYNOPSIS
--------
| nfdc face [list]
| nfdc face show <FACEID>
| nfdc face show [id] <FACEID>
| nfdc face create [remote] <FACEURI> [[persistency] <PERSISTENCY>]
| nfdc face destroy <FACEID|FACEURI>
| nfdc face destroy [face] <FACEID|FACEURI>
| nfdc channel [list]
DESCRIPTION
+14 -9
View File
@@ -47,22 +47,27 @@ registerCommands(CommandParser& parser)
{
std::string subcommand;
std::string title;
std::string replacementCommand; ///< replacement for deprecated legacy subcommand
};
const std::vector<LegacyNfdcCommandDefinition> legacyNfdcSubcommands{
{"register", "register a prefix"},
{"unregister", "unregister a prefix"},
{"create", "create a face"},
{"destroy", "destroy a face"},
{"set-strategy", "set strategy choice on namespace"},
{"unset-strategy", "unset strategy choice on namespace"},
{"add-nexthop", "add FIB nexthop"},
{"remove-nexthop", "remove FIB nexthop"}
{"register", "register a prefix", ""},
{"unregister", "unregister a prefix", ""},
{"create", "create a face", "face create"},
{"destroy", "destroy a face", "face destroy"},
{"set-strategy", "set strategy choice on namespace", ""},
{"unset-strategy", "unset strategy choice on namespace", ""},
{"add-nexthop", "add FIB nexthop", ""},
{"remove-nexthop", "remove FIB nexthop", ""}
};
for (const LegacyNfdcCommandDefinition& lncd : legacyNfdcSubcommands) {
CommandDefinition def(lncd.subcommand, "");
def.setTitle(lncd.title);
def.addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
parser.addCommand(def, &legacyNfdcMain);
auto modes = AVAILABLE_IN_ONE_SHOT | AVAILABLE_IN_HELP;
if (!lncd.replacementCommand.empty()) {
modes = modes & ~AVAILABLE_IN_HELP;
}
parser.addCommand(def, bind(&legacyNfdcMain, _1, lncd.replacementCommand), modes);
}
}
+6 -1
View File
@@ -326,8 +326,13 @@ legacyNfdcUsage()
}
void
legacyNfdcMain(ExecuteContext& ctx)
legacyNfdcMain(ExecuteContext& ctx, const std::string& replacementCommand)
{
if (!replacementCommand.empty()) {
std::cerr << "'nfdc " << ctx.noun << "' command is deprecated. "
<< "Use 'nfdc " << replacementCommand << "' instead.\n";
}
LegacyNfdc p(ctx.face, ctx.keyChain);
const std::string& subcommand = ctx.noun;
+1 -1
View File
@@ -174,7 +174,7 @@ void
legacyNfdcUsage();
void
legacyNfdcMain(ExecuteContext& ctx);
legacyNfdcMain(ExecuteContext& ctx, const std::string& replacementCommand);
} // namespace nfdc
} // namespace tools