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

Method type

library/Commands.cpp:243–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241 }
242
243 command_result Commands::type(color_ostream& con, Core& core, const std::string& first, const std::vector<std::string>& parts)
244 {
245 auto plug_mgr = core.getPluginManager();
246
247 if (!parts.size())
248 {
249 con.printerr("type: no argument\n");
250 return CR_WRONG_USAGE;
251 }
252 con << parts[0];
253 bool builtin = is_builtin(con, parts[0]);
254 std::filesystem::path lua_path = core.findScript(parts[0] + ".lua");
255 Plugin* plug = plug_mgr->getPluginByCommand(parts[0]);
256 if (builtin)
257 {
258 con << " is a built-in command";
259 con << std::endl;
260 }
261 else if (core.IsAlias(parts[0]))
262 {
263 con << " is an alias: " << core.GetAliasCommand(parts[0]) << std::endl;
264 }
265 else if (plug)
266 {
267 con << " is a command implemented by the plugin " << plug->getName() << std::endl;
268 }
269 else if (!lua_path.empty())
270 {
271 con << " is a Lua script: " << lua_path << std::endl;
272 }
273 else
274 {
275 con << " is not a recognized command." << std::endl;
276 plug = plug_mgr->getPluginByName(parts[0]);
277 if (plug)
278 con << "Plugin " << parts[0] << " exists and implements " << plug->size() << " commands." << std::endl;
279 return CR_FAILURE;
280 }
281 return CR_OK;
282 }
283
284 command_result Commands::keybinding(color_ostream& con, Core& core, const std::string& first, const std::vector<std::string>& parts)
285 {

Callers 15

MakePrimitiveMetatableFunction · 0.45
ListMaterialsFunction · 0.45
find_union_tagMethod · 0.45
push_object_internalMethod · 0.45
is_type_compatibleMethod · 0.45
meta_sizeofFunction · 0.45
meta_newFunction · 0.45
meta_ptr_tostringFunction · 0.45
RenderTypeFunction · 0.45
orders_import_commandFunction · 0.45
PassKeyboardEventFunction · 0.45
read_ammoMethod · 0.45

Calls 7

findScriptMethod · 0.80
getPluginByCommandMethod · 0.80
IsAliasMethod · 0.80
GetAliasCommandMethod · 0.80
sizeMethod · 0.45
getNameMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected