| 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 | { |
no test coverage detected