nitc :: CmdModelEntities :: defaultinit
# A command that returns a list of all mentities in a model
class CmdModelEntities
super CmdEntities
# Kind of mentities to be returned.
#
# Value must be one of "packages", "groups", "modules", "classes", "classdefs",
# "properties", "propdefs" or "all".
#
# Default is "all".
var kind = "all" is optional, writable
# Default limit is `10`
redef var limit = 10
redef fun init_results do
if results != null then return new CmdSuccess
var res = super
if not res isa CmdSuccess then return res
var mentities = new Array[MEntity]
if kind == "packages" then
mentities = model.collect_mpackages(filter).to_a
else if kind == "groups" then
mentities = model.collect_mgroups(filter).to_a
else if kind == "modules" then
mentities = model.collect_mmodules(filter).to_a
else if kind == "classes" then
mentities = model.collect_mclasses(filter).to_a
else if kind == "classdefs" then
mentities = model.collect_mclassdefs(filter).to_a
else if kind == "properties" then
mentities = model.collect_mproperties(filter).to_a
else if kind == "propdefs" then
mentities = model.collect_mpropdefs(filter).to_a
else
mentities = model.collect_mentities(filter).to_a
end
results = mentities
return res
end
end
src/doc/commands/commands_model.nit:483,1--525,3