summaryrefslogtreecommitdiff
path: root/src/command_manager.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-01-15 03:02:08 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-01-15 03:02:08 +0000
commitf259af9326b4e2140f856f1651eaeb0d74537621 (patch)
tree14dd4064c0562500c25c4b3e58f49ed92f292ed7 /src/command_manager.hh
parentbe5cf9236750eb1fd38f0dd3ebc4da2af1fd87ab (diff)
CommandManager: add flags support and IgnoreSemiColons flag
commands are now registred with flags, and the IgnoreSemiColons flag permit to specify a command which needs all the parameters on the line, bypassing the command sequence operator ';'. the hook command is tagged as such.
Diffstat (limited to 'src/command_manager.hh')
-rw-r--r--src/command_manager.hh13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/command_manager.hh b/src/command_manager.hh
index 6b73b47d..125db6e1 100644
--- a/src/command_manager.hh
+++ b/src/command_manager.hh
@@ -53,6 +53,12 @@ private:
class CommandManager : public Singleton<CommandManager>
{
public:
+ enum Flags
+ {
+ None = 0,
+ IgnoreSemiColons = 1,
+ };
+
void execute(const std::string& command_line, const Context& context);
void execute(const CommandParameters& params, const Context& context);
@@ -60,19 +66,22 @@ public:
void register_command(const std::string& command_name,
Command command,
+ unsigned flags = None,
const CommandCompleter& completer = CommandCompleter());
void register_command(const std::vector<std::string>& command_names,
Command command,
+ unsigned flags = None,
const CommandCompleter& completer = CommandCompleter());
private:
- struct CommandAndCompleter
+ struct CommandDescriptor
{
Command command;
+ unsigned flags;
CommandCompleter completer;
};
- std::unordered_map<std::string, CommandAndCompleter> m_commands;
+ std::unordered_map<std::string, CommandDescriptor> m_commands;
};
}