diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-06 21:37:43 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-06 21:37:43 +0200 |
| commit | a712dd5bbe8d2b4b433ce90f7d977acf762ad080 (patch) | |
| tree | f5d8b0b8f6d5724aa4f84cb173c1f01b753621c4 /src/command_manager.hh | |
| parent | 39797f87dc73675881854b38611489de1dba6b8f (diff) | |
Completions functions take a Context parameter
Diffstat (limited to 'src/command_manager.hh')
| -rw-r--r-- | src/command_manager.hh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/command_manager.hh b/src/command_manager.hh index a440de59..298b9056 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -26,19 +26,22 @@ using CommandParameters = memoryview<String>; typedef std::function<void (const CommandParameters&, const Context& context)> Command; -typedef std::function<CandidateList (const CommandParameters&, +typedef std::function<CandidateList (const Context& context, + const CommandParameters&, size_t, size_t)> CommandCompleter; class PerArgumentCommandCompleter { public: - typedef std::function<CandidateList (const String&, size_t)> ArgumentCompleter; + typedef std::function<CandidateList (const Context&, + const String&, size_t)> ArgumentCompleter; typedef memoryview<ArgumentCompleter> ArgumentCompleterList; PerArgumentCommandCompleter(const ArgumentCompleterList& completers) : m_completers(completers.begin(), completers.end()) {} - CandidateList operator()(const CommandParameters& params, + CandidateList operator()(const Context& context, + const CommandParameters& params, size_t token_to_complete, size_t pos_in_token) const; @@ -52,7 +55,8 @@ public: void execute(const String& command_line, const Context& context, const EnvVarMap& env_vars = EnvVarMap()); - Completions complete(const String& command_line, size_t cursor_pos); + Completions complete(const Context& context, + const String& command_line, size_t cursor_pos); bool command_defined(const String& command_name) const; |
