nitc :: CmdEntityFile :: defaultinit
nitc :: CmdEntityFile :: print_file
Print filenitc :: CmdEntityFile :: throw_warning
nitc $ CmdEntityFile :: SELF
Type of this instance, automatically specialized in every classnitc :: html_commands $ CmdEntityFile :: to_html
Render results as a HTML stringnitc :: md_commands $ CmdEntityFile :: to_md
Render results as a Markdown stringnitc :: 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.core :: Object :: defaultinit
nitc :: CmdEntityFile :: 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 :: CmdEntityFile :: print_file
Print filenitc :: CmdEntityFile :: throw_warning
nitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
mentity
mentity
mentity
abstract class CmdEntityFile
super CmdEntity
# File path
var file: nullable String = null is writable
# Accepted file names
fun file_names: Array[String] is abstract
# Init file related data
fun init_file: CmdMessage do
var mentity = self.mentity.as(not null)
var source_file = mentity.location.file
if source_file == null then return throw_warning
for file_name in file_names do
var file = source_file.filename / file_name
if not file.file_exists then continue
self.file = file
break
end
if file == null then return throw_warning
return new CmdSuccess
end
redef fun init_command do
var res = super
if not res isa CmdSuccess then return res
return init_file
end
fun throw_warning: CmdWarning is abstract
end
src/doc/commands/commands_ini.nit:262,1--297,3
redef class CmdEntityFile
# URL to the file
#
# Can be refined in subtools.
var file_url: nullable String = file is lazy, writable
redef fun to_md do
var file = self.file
if file == null then return ""
return "[{file.basename}]({file_url or else ""})"
end
end
src/doc/templates/md_commands.nit:258,1--270,3
redef class CmdEntityFile
# Print file
fun print_file(title: String, no_color: nullable Bool) do
var file = self.file
if file == null then return
title = "{title} `{file}`:"
if no_color == null or not no_color then
print title.bold
else
print title
end
print ""
print file.to_path.read_all
print ""
end
end
src/doc/term/term.nit:426,1--442,3