mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
zcmdcat: Initial infrastructure.
This commit is contained in:
parent
f5571c80c6
commit
8eb965d71d
2 changed files with 33 additions and 1 deletions
|
@ -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 ()
|
Command::Command ()
|
||||||
: _usage ("")
|
: _category(Category::unassigned)
|
||||||
|
, _usage ("")
|
||||||
, _description ("")
|
, _description ("")
|
||||||
, _read_only (true)
|
, _read_only (true)
|
||||||
, _displays_id (true)
|
, _displays_id (true)
|
||||||
|
|
|
@ -47,8 +47,24 @@ public:
|
||||||
bool displays_id () const;
|
bool displays_id () const;
|
||||||
virtual int execute (std::string&) = 0;
|
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:
|
protected:
|
||||||
bool permission (const Task&, const std::string&, unsigned int);
|
bool permission (const Task&, const std::string&, unsigned int);
|
||||||
|
static const std::map <Command::Category, std::string> categoryNames;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string _keyword;
|
std::string _keyword;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue