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

Function invoke_command

plugins/hotkeys.cpp:136–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static bool invoke_command(color_ostream &out, const size_t index) {
137 auto screen = Core::getTopViewscreen();
138 if (sorted_keys.size() <= index ||
139 !Gui::matchFocusString(MENU_SCREEN_FOCUS_STRING))
140 return false;
141
142 auto cmd = current_bindings[sorted_keys[index]];
143 DEBUG(log).print("invoking command: '{}'\n", cmd);
144
145 {
146 Screen::Hide hideGuard(screen, Screen::Hide::RESTORE_AT_TOP);
147 Core::getInstance().runCommand(out, cmd);
148 }
149
150 Screen::dismiss(screen);
151 return true;
152}
153
154static command_result hotkeys_cmd(color_ostream &out, vector <string> & parameters) {
155 if (!parameters.size()) {

Callers 1

hotkeys_cmdFunction · 0.85

Calls 3

runCommandMethod · 0.80
sizeMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected