MCPcopy Create free account
hub / github.com/DFHack/dfhack / hotkeys_cmd

Function hotkeys_cmd

plugins/hotkeys.cpp:154–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154static command_result hotkeys_cmd(color_ostream &out, vector <string> & parameters) {
155 if (!parameters.size()) {
156 DEBUG(log).print("invoking command: '{}'\n", INVOKE_MENU_DEFAULT_COMMAND);
157 return Core::getInstance().runCommand(out, INVOKE_MENU_DEFAULT_COMMAND);
158 } else if (parameters.size() == 2 && parameters[0] == "menu") {
159 string cmd = INVOKE_MENU_BASE_COMMAND + parameters[1];
160 DEBUG(log).print("invoking command: '{}'\n", cmd);
161 return Core::getInstance().runCommand(out, cmd);
162 }
163
164 if (parameters[0] == "list") {
165 list(out);
166 return CR_OK;
167 }
168
169 // internal command -- intentionally undocumented
170 if (parameters.size() != 2 || parameters[0] != "invoke")
171 return CR_WRONG_USAGE;
172
173 int index = string_to_int(parameters[1], -1);
174 if (index < 0)
175 return CR_WRONG_USAGE;
176 return invoke_command(out, index) ? CR_OK : CR_WRONG_USAGE;
177}
178
179DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) {
180 commands.push_back(

Callers

nothing calls this directly

Calls 6

listFunction · 0.85
string_to_intFunction · 0.85
invoke_commandFunction · 0.85
runCommandMethod · 0.80
sizeMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected