mentity
nitc :: CmdEntityCode :: _format
nitc :: CmdEntityCode :: _modelbuilder
ModelBuilder used to get AST nodes from entitiesnitc :: CmdEntityCode :: defaultinit
nitc :: CmdEntityCode :: modelbuilder
ModelBuilder used to get AST nodes from entitiesnitc :: CmdEntityCode :: modelbuilder=
ModelBuilder used to get AST nodes from entitiesnitc $ CmdEntityCode :: SELF
Type of this instance, automatically specialized in every classnitc :: commands_http $ CmdEntityCode :: http_init
FIXME avoid linearization conflictnitc $ CmdEntityCode :: init_command
Same asCmdEntity::init_mentity
nitc :: CmdEntityCode :: _format
nitc :: CmdEntity :: _mentity_name
Name of the mentity this command is aboutnitc :: CmdEntityCode :: _modelbuilder
ModelBuilder used to get AST nodes from entitiescore :: 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 :: CmdCode :: defaultinit
core :: Object :: defaultinit
nitc :: CmdEntityCode :: defaultinit
nitc :: CmdEntity :: 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 :: CmdEntity :: mentity_name
Name of the mentity this command is aboutnitc :: CmdEntity :: mentity_name=
Name of the mentity this command is aboutnitc :: CmdEntityCode :: modelbuilder
ModelBuilder used to get AST nodes from entitiesnitc :: CmdEntityCode :: modelbuilder=
ModelBuilder used to get AST nodes from entitiescore :: 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 :: CmdCode :: render_code
Rendernode
depending on the selected format
nitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
# Cmd that finds the source code related to an `mentity`
class CmdEntityCode
super CmdEntity
super CmdCode
autoinit(model, modelbuilder, filter, mentity, mentity_name, format)
# ModelBuilder used to get AST nodes from entities
var modelbuilder: ModelBuilder
# Same as `CmdEntity::init_mentity`
#
# Plus `WarningNoCode` if no code/AST node is found for `mentity`.
redef fun init_command do
if node != null then return new CmdSuccess
var res = super
if not res isa CmdSuccess then return res
var mentity = self.mentity.as(not null)
if mentity isa MClass then mentity = mentity.intro
if mentity isa MProperty then mentity = mentity.intro
node = modelbuilder.mentity2node(mentity)
if node == null then return new WarningNoCode(mentity)
return res
end
end
src/doc/commands/commands_model.nit:443,1--469,3
redef class CmdEntityCode
# FIXME avoid linearization conflict
redef fun http_init(req) do
var name = req.param("id")
if name != null then name = name.from_percent_encoding
mentity_name = name
var opt_format = req.string_arg("format")
if opt_format != null then format = opt_format
return init_command
end
end
src/doc/commands/commands_http.nit:175,1--186,3
redef class CmdEntityCode
redef var format = "ansi" is optional
redef fun execute(no_color) do
var mentity = self.mentity
if mentity == null then return
var title = "Code for `{mentity.cs_full_name(no_color)}`:"
if no_color == null or not no_color then
print title.bold
else
print title
end
var node = self.node
if (no_color == null or not no_color) and node != null then
var ansi = render_code(node)
print "~~~"
print ansi.write_to_string
print "~~~"
else
printn mentity.cs_source_code
end
end
end
src/doc/term/term.nit:211,1--235,3