mentity
nitc :: CmdMainCompile :: _command
nitc :: CmdMainCompile :: _file
nitc :: CmdMainCompile :: command
nitc :: CmdMainCompile :: command=
nitc :: CmdMainCompile :: defaultinit
nitc :: CmdMainCompile :: file
nitc :: CmdMainCompile :: file=
nitc :: CmdMainCompile :: mmodule_main
Doesmmodule
has a main
method?
nitc :: CmdMainCompile :: test_path
Return the sourcefile pathnitc $ CmdMainCompile :: SELF
Type of this instance, automatically specialized in every classnitc :: html_commands $ CmdMainCompile :: to_html
Render results as a HTML stringnitc :: json_commands $ CmdMainCompile :: to_json
Return a JSON Serializable representation ofself
results
nitc :: md_commands $ CmdMainCompile :: to_md
Render results as a Markdown stringnitc :: CmdMainCompile :: _command
nitc :: CmdMainCompile :: _file
nitc :: 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 :: CmdMainCompile :: command
nitc :: CmdMainCompile :: command=
nitc :: CmdMainCompile :: defaultinit
core :: Object :: defaultinit
nitc :: CmdEntity :: defaultinit
nitc :: DocCommand :: defaultinit
nitc :: DocCommand :: execute
nitc :: CmdMainCompile :: file
nitc :: CmdMainCompile :: file=
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 :: CmdMainCompile :: mmodule_main
Doesmmodule
has a main
method?
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 :: CmdMainCompile :: test_path
Return the sourcefile pathnitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
# Cmd that finds the nitc command related to an `mentity`
class CmdMainCompile
super CmdEntity
var file: nullable SourceFile = null
var command: nullable String is lazy do
var path = test_path(file)
if path == null then return null
return "nitc {path}"
end
redef fun init_command do
var res = super
if not res isa CmdSuccess then return res
var mentity = self.mentity.as(not null)
if mentity isa MModule then
file = mmodule_main(mentity)
if file == null then return new WarningNoMain(mentity)
else
return new WarningNoMain(mentity)
end
return res
end
# Does `mmodule` has a `main` method?
private fun mmodule_main(mmodule: MModule): nullable SourceFile do
for mclassdef in mmodule.mclassdefs do
if mclassdef.name != "Sys" then continue
for mpropdef in mclassdef.mpropdefs do
if mpropdef.name == "main" then return mmodule.location.file
end
end
return null
end
# Return the sourcefile path
#
# This method exists for the only purpose to be redefined by nitunit tests
# to avoid path diffs.
private fun test_path(file: nullable SourceFile): nullable String do
if file == null then return null
var base_path = mentity.as(MModule).mpackage.as(not null).location.file.as(not null).filename
return file.filename.replace(base_path, "")
end
end
src/doc/commands/commands_main.nit:73,1--119,3
redef class CmdMainCompile
redef fun to_json do
var obj = new JsonObject
obj["command"] = command
return obj
end
end
src/doc/templates/json_commands.nit:264,1--270,3
redef class CmdMainCompile
redef fun execute(no_color) do
var mentity = self.mentity.as(not null).full_name
if no_color == null or not no_color then mentity = mentity.blue.bold
var title = "Compiling `{mentity}`:"
if no_color == null or not no_color then
print title.bold
else
print title
end
print ""
var command = self.command
if command != null then print command
end
end
src/doc/term/term.nit:466,1--482,3