zcmdcat: Initial infrastructure.
This commit is contained in:
committed by
Paul Beckingham
parent
f5571c80c6
commit
8eb965d71d
@@ -193,9 +193,25 @@ void Command::factory (std::map <std::string, Command*>& all)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::map <Command::Category, std::string> Command::categoryNames =
|
||||
{
|
||||
// These strings are intentionally not l10n'd: they are used as identifiers.
|
||||
{Command::Category::unassigned, "unassigned"} // should never happen
|
||||
,{Command::Category::interrogator, "interrogator"}
|
||||
,{Command::Category::report, "report"}
|
||||
,{Command::Category::operation, "operation"}
|
||||
,{Command::Category::graphs, "graphs" }
|
||||
,{Command::Category::config, "config" }
|
||||
,{Command::Category::migration, "migration"}
|
||||
,{Command::Category::misc, "misc" }
|
||||
,{Command::Category::internal, "internal"}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Command::Command ()
|
||||
: _usage ("")
|
||||
: _category(Category::unassigned)
|
||||
, _usage ("")
|
||||
, _description ("")
|
||||
, _read_only (true)
|
||||
, _displays_id (true)
|
||||
|
||||
@@ -47,8 +47,24 @@ public:
|
||||
bool displays_id () const;
|
||||
virtual int execute (std::string&) = 0;
|
||||
|
||||
enum class Category
|
||||
{
|
||||
unassigned,
|
||||
interrogator,
|
||||
report,
|
||||
operation,
|
||||
graphs,
|
||||
config,
|
||||
migration,
|
||||
misc,
|
||||
internal,
|
||||
// Whenever you extend this enum, update categoryNames.
|
||||
};
|
||||
Category _category;
|
||||
|
||||
protected:
|
||||
bool permission (const Task&, const std::string&, unsigned int);
|
||||
static const std::map <Command::Category, std::string> categoryNames;
|
||||
|
||||
protected:
|
||||
std::string _keyword;
|
||||
|
||||
Reference in New Issue
Block a user