summaryrefslogtreecommitdiff
path: root/src/command_manager.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2011-09-13 21:16:48 +0000
committerMaxime Coste <frrrwww@gmail.com>2011-09-13 21:16:48 +0000
commiteecc5a184e4a3aacaf2984f2171a58440bebc43c (patch)
tree2337006a7b48c5399b8323320188ff65bf10afc8 /src/command_manager.hh
parent030c5caf0a92c03ec2afca677483044de3bbef56 (diff)
CommandManager: basic command name completion support
Diffstat (limited to 'src/command_manager.hh')
-rw-r--r--src/command_manager.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/command_manager.hh b/src/command_manager.hh
index 2f014838..fc3d81f3 100644
--- a/src/command_manager.hh
+++ b/src/command_manager.hh
@@ -20,10 +20,21 @@ struct wrong_argument_count : runtime_error
typedef std::vector<std::string> CommandParameters;
typedef std::function<void (const CommandParameters&)> Command;
+struct Completions
+{
+ CommandParameters candidates;
+ size_t start;
+ size_t end;
+
+ Completions(size_t start, size_t end)
+ : start(start), end(end) {}
+};
+
class CommandManager
{
public:
void execute(const std::string& command_line);
+ Completions complete(const std::string& command_line, size_t cursor_pos);
void register_command(const std::string& command_name, Command command);
void register_command(const std::vector<std::string>& command_names, Command command);