mentity
nitc :: CmdIniContributors :: _contributors
Contributors listnitc :: CmdIniContributors :: contributors
Contributors listnitc :: CmdIniContributors :: contributors=
Contributors listnitc $ CmdIniContributors :: SELF
Type of this instance, automatically specialized in every classnitc :: html_commands $ CmdIniContributors :: to_html
Render results as a HTML stringnitc :: json_commands $ CmdIniContributors :: to_json
Return a JSON Serializable representation ofself
results
nitc :: md_commands $ CmdIniContributors :: to_md
Render results as a Markdown stringnitc :: CmdIniContributors :: _contributors
Contributors listnitc :: CmdEntity :: _mentity_name
Name of the mentity this command is aboutcore :: 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 :: CmdIniContributors :: contributors
Contributors listnitc :: CmdIniContributors :: contributors=
Contributors listcore :: Object :: defaultinit
nitc :: CmdIni :: 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 aboutcore :: 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 :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
# Cmd that finds the contributors list of an `mentity`
class CmdIniContributors
super CmdIni
# Contributors list
var contributors: nullable Array[String] = null
redef fun init_command do
var res = super
if not res isa CmdSuccess then return res
var mentity = self.mentity.as(not null)
var ini = self.ini.as(not null)
var names = ini["package.more_contributors"]
if names == null then return new WarningNoContributor(mentity)
var contributors = new Array[String]
for name in names.split(",") do
contributors.add name.trim
end
if contributors.is_empty then return new WarningNoContributor(mentity)
self.contributors = contributors
return res
end
end
src/doc/commands/commands_ini.nit:192,1--218,3
redef class CmdIniContributors
redef fun to_json do
var obj = new JsonObject
obj["contributors"] = contributors
return obj
end
end
src/doc/templates/json_commands.nit:206,1--212,3
redef class CmdIniContributors
redef fun execute(no_color) do
var contributors = self.contributors
if contributors == null then return
var title = "Contributors list from ini file:"
if no_color == null or not no_color then
print title.bold
else
print title
end
print ""
for contributor in contributors do
print " * {contributor}"
end
end
end
src/doc/term/term.nit:402,1--417,3
redef class CmdIniContributors
redef fun to_html do
var names = self.contributors
if names == null or names.is_empty then return ""
var tpl = new Template
tpl.add "<ul>"
for name in names do
tpl.add "<li><b>{name.html_escape}</b></li>"
end
tpl.add "</ul>"
return tpl.write_to_string
end
end
src/doc/templates/html_commands.nit:263,1--276,3