| 122 | } |
| 123 | |
| 124 | static command_result enable_tweak(string tweak, color_ostream &out, vector<string> ¶meters) { |
| 125 | bool recognized = false; |
| 126 | string cmd = parameters[0]; |
| 127 | for (auto &entry : tweak_hooks) { |
| 128 | if (entry.first == cmd) { |
| 129 | recognized = true; |
| 130 | enable_hook(out, entry.second, parameters); |
| 131 | } |
| 132 | } |
| 133 | is_enabled = false; |
| 134 | for (auto & entry : tweak_onupdate_hooks) { |
| 135 | tweak_onupdate_hookst &hook = entry.second; |
| 136 | if (entry.first == cmd) { |
| 137 | bool state = (vector_get(parameters, 1) != "disable"); |
| 138 | recognized = true; |
| 139 | hook.enabled = state; |
| 140 | out.print("{} tweak {} ({})\n", state ? "Enabled" : "Disabled", cmd, hook.name); |
| 141 | } |
| 142 | if (hook.enabled) |
| 143 | is_enabled = true; |
| 144 | } |
| 145 | if (!recognized) { |
| 146 | out.printerr("Unrecognized tweak: {}\n", cmd); |
| 147 | out.print("Run 'help tweak' to display a full list\n"); |
| 148 | return CR_FAILURE; // Avoid dumping usage information |
| 149 | } |
| 150 | return CR_OK; |
| 151 | } |
| 152 | |
| 153 | static std::map<string, bool> get_status() { |
| 154 | std::map<string, bool> list; |
no test coverage detected