nitc :: CmdModelEntities :: defaultinit
nitc :: CmdModelEntities :: kind=
Kind of mentities to be returned.nitc $ CmdModelEntities :: SELF
Type of this instance, automatically specialized in every classnitc :: commands_http $ CmdModelEntities :: http_init
Init the command from an HTTPRequestnitc $ CmdModelEntities :: init_results
Initialize theresults
list
nitc :: commands_parser $ CmdModelEntities :: parser_init
Initialize the command from the CommandParser datanitc :: CmdEntities :: _sorter
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: DocCommand :: cmd_filter
Return a new filter for that command execution.nitc :: CmdModelEntities :: defaultinit
nitc :: CmdEntities :: defaultinit
core :: Object :: defaultinit
nitc :: CmdList :: defaultinit
nitc :: DocCommand :: defaultinit
nitc :: DocCommand :: execute
nitc :: DocCommand :: filter=
ModelFilter to apply if anynitc :: DocCommand :: http_init
Init the command from an HTTPRequestcore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: CmdModelEntities :: kind=
Kind of mentities to be returned.core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: DocCommand :: parser_init
Initialize the command from the CommandParser datanitc :: CmdList :: print_list
nitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
# 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
redef class CmdModelEntities
redef fun parser_init(kind, options) do
self.kind = kind
return super
end
end
src/doc/commands/commands_parser.nit:356,1--361,3
redef class CmdModelEntities
redef fun http_init(req) do
var opt_kind = req.string_arg("kind")
if opt_kind != null then kind = opt_kind
return super
end
end
src/doc/commands/commands_http.nit:159,1--165,3
redef class CmdModelEntities
redef fun execute(no_color) do
var kind = self.kind
if no_color != null and not no_color then kind = kind.blue
print_list("MEntities for kind `{kind}`:", results, no_color)
end
end
src/doc/term/term.nit:196,1--202,3