Commit b53c4006 authored by aligungr's avatar aligungr

UE de-registration improvement

parent d042a7a4
......@@ -23,7 +23,7 @@
static opt::OptionsDescription Desc(const std::string &subCommand, const std::string &desc, const std::string &usage,
bool helpIfEmpty)
{
return {subCommand, cons::Tag, desc, {}, subCommand, {usage}, helpIfEmpty};
return {{}, {}, desc, {}, subCommand, {usage}, helpIfEmpty, true};
}
class OptionsHandler : public opt::IOptionsHandler
......@@ -71,9 +71,9 @@ static std::map<std::string, std::string> g_gnbCmdToDescription = {
};
static std::map<std::string, std::string> g_gnbCmdToUsage = {
{"status", "[option...]"}, {"info", "[option...]"},
{"amf-list", "[option...]"}, {"amf-info", "<amf-id> [option...]"},
{"ue-list", "[option...]"}, {"ue-count", "[option...]"},
{"status", ""}, {"info", ""},
{"amf-list", ""}, {"amf-info", "<amf-id>"},
{"ue-list", ""}, {"ue-count", ""},
};
static std::map<std::string, bool> g_gnbCmdToHelpIfEmpty = {{"status", false}, {"info", false},
......@@ -88,9 +88,9 @@ static std::map<std::string, std::string> g_ueCmdToDescription = {
};
static std::map<std::string, std::string> g_ueCmdToUsage = {
{"info", "[option...]"},
{"status", "[option...]"},
{"timers", "[option...]"},
{"info", ""},
{"status", ""},
{"timers", ""},
{"deregister", "<switch-off|disable-5g|normal>"},
};
......
......@@ -133,7 +133,7 @@ static void ReadOptions(int argc, char **argv)
{
opt::OptionsDescription desc{"UERANSIM", cons::Tag, "Command Line Interface",
cons::Owner, "nr-cli", {"<node-name> [option...]", "--dump"},
true};
true, false};
opt::OptionItem itemDump = {'d', "dump", "List all UE and gNBs in the environment", std::nullopt};
opt::OptionItem itemExec = {'e', "exec", "Execute the given command directly without an interactive shell",
......
......@@ -79,7 +79,7 @@ static void ReadOptions(int argc, char **argv)
{
opt::OptionsDescription desc{cons::Project, cons::Tag, "5G-SA gNB implementation",
cons::Owner, "nr-gnb", {"-c <config-file> [option...]"},
true};
true, false};
opt::OptionItem itemConfigFile = {'c', "config", "Use specified configuration file for gNB", "config-file"};
opt::OptionItem itemDisableCmd = {'l', "disable-cmd", "Disable command line functionality for this instance",
......
......@@ -132,7 +132,7 @@ static void ReadOptions(int argc, char **argv)
{
opt::OptionsDescription desc{cons::Project, cons::Tag, "5G-SA UE implementation",
cons::Owner, "nr-ue", {"-c <config-file> [option...]"},
true};
true, false};
opt::OptionItem itemConfigFile = {'c', "config", "Use specified configuration file for UE", "config-file"};
opt::OptionItem itemImsi = {'i', "imsi", "Use specified IMSI number instead of provided one", "imsi"};
......
......@@ -269,10 +269,15 @@ void opt::OptionsResult::showHelp() const
ostream << " " << m_description.programName << " " << usage << std::endl;
ostream << std::endl;
ostream << "Options:" << std::endl;
std::vector<OptionItem> items = m_description.items;
items.emplace_back('h', "help", "Show this help message and exit", std::nullopt);
items.emplace_back('v', "version", "Show version information and exit", std::nullopt);
if (!m_description.hideDefaultOptionsInUsage)
{
items.emplace_back('h', "help", "Show this help message and exit", std::nullopt);
items.emplace_back('v', "version", "Show version information and exit", std::nullopt);
}
if (!items.empty())
ostream << "Options:" << std::endl;
size_t maxLengthOfItemName = 0;
for (auto &item : items)
......
......@@ -73,12 +73,14 @@ struct OptionsDescription
std::vector<OptionItem> items{};
std::vector<std::string> usages{};
bool helpIfEmpty{};
bool hideDefaultOptionsInUsage{};
OptionsDescription(std::string projectName, std::string version, std::string appDescription, std::string copyright,
std::string programName, std::vector<std::string> usages, bool helpIfEmpty)
std::string programName, std::vector<std::string> usages, bool helpIfEmpty,
bool hideDefaultOptionsInUsage)
: projectName(std::move(projectName)), version(std::move(version)), appDescription(std::move(appDescription)),
copyright(std::move(copyright)), programName(std::move(programName)), usages(std::move(usages)),
helpIfEmpty(helpIfEmpty)
helpIfEmpty(helpIfEmpty), hideDefaultOptionsInUsage(hideDefaultOptionsInUsage)
{
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment