Add an option that hides CLI commands

fixes #7702
This commit is contained in:
Gunnar Beutner 2014-11-17 18:42:22 +01:00
parent ea729b2b6c
commit d532300cba
2 changed files with 7 additions and 1 deletions

View File

@ -101,6 +101,11 @@ int CLICommand::GetMaxArguments(void) const
return GetMinArguments(); return GetMinArguments();
} }
bool CLICommand::IsHidden(void) const
{
return false;
}
boost::mutex& CLICommand::GetRegistryMutex(void) boost::mutex& CLICommand::GetRegistryMutex(void)
{ {
static boost::mutex mtx; static boost::mutex mtx;
@ -271,7 +276,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) { BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
const std::vector<String>& vname = kv.first; const std::vector<String>& vname = kv.first;
if (vname.size() < best_match.size()) if (vname.size() < best_match.size() || kv.second->IsHidden())
continue; continue;
bool match = true; bool match = true;

View File

@ -58,6 +58,7 @@ public:
virtual String GetShortDescription(void) const = 0; virtual String GetShortDescription(void) const = 0;
virtual int GetMinArguments(void) const; virtual int GetMinArguments(void) const;
virtual int GetMaxArguments(void) const; virtual int GetMaxArguments(void) const;
virtual bool IsHidden(void) const;
virtual void InitParameters(boost::program_options::options_description& visibleDesc, virtual void InitParameters(boost::program_options::options_description& visibleDesc,
boost::program_options::options_description& hiddenDesc) const; boost::program_options::options_description& hiddenDesc) const;
virtual ImpersonationLevel GetImpersonationLevel(void) const; virtual ImpersonationLevel GetImpersonationLevel(void) const;