yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
autocomplete.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_UTIL_AUTOCOMPLETE_H_
2#define YAZE_CLI_UTIL_AUTOCOMPLETE_H_
3
4#include <string>
5#include <vector>
6#include <functional>
7
8namespace yaze {
9namespace cli {
10
11struct Suggestion {
12 std::string text;
13 std::string description;
14 std::string example;
15 int score;
16};
17
19 public:
20 void RegisterCommand(const std::string& cmd, const std::string& desc,
21 const std::vector<std::string>& examples = {});
22
23 void RegisterParameter(const std::string& param, const std::string& desc,
24 const std::vector<std::string>& values = {});
25
26 std::vector<Suggestion> GetSuggestions(const std::string& input);
27
28 std::vector<Suggestion> GetContextualHelp(const std::string& partial_cmd);
29
30 void SetRomContext(bool has_rom) { has_rom_ = has_rom; }
31
32 private:
33 struct CommandDef {
34 std::string name;
35 std::string description;
36 std::vector<std::string> params;
37 std::vector<std::string> examples;
38 };
39
40 std::vector<CommandDef> commands_;
41 bool has_rom_ = false;
42
43 int FuzzyScore(const std::string& text, const std::string& query);
44};
45
46} // namespace cli
47} // namespace yaze
48
49#endif // YAZE_CLI_UTIL_AUTOCOMPLETE_H_
void RegisterCommand(const std::string &cmd, const std::string &desc, const std::vector< std::string > &examples={})
std::vector< CommandDef > commands_
int FuzzyScore(const std::string &text, const std::string &query)
void RegisterParameter(const std::string &param, const std::string &desc, const std::vector< std::string > &values={})
void SetRomContext(bool has_rom)
std::vector< Suggestion > GetContextualHelp(const std::string &partial_cmd)
std::vector< Suggestion > GetSuggestions(const std::string &input)
Main namespace for the application.
std::vector< std::string > examples
std::vector< std::string > params
std::string description