nitc :: CmdManSynopsis :: _synopsis
Synopsis string extracted from mannitc :: CmdManSynopsis :: defaultinit
nitc :: CmdManSynopsis :: synopsis=
Synopsis string extracted from mannitc $ CmdManSynopsis :: SELF
Type of this instance, automatically specialized in every classnitc :: html_commands $ CmdManSynopsis :: to_html
Render results as a HTML stringnitc :: json_commands $ CmdManSynopsis :: to_json
Return a JSON Serializable representation ofself
results
nitc :: md_commands $ CmdManSynopsis :: to_md
Render results as a Markdown stringnitc :: CmdEntity :: _mentity_name
Name of the mentity this command is aboutnitc :: CmdManSynopsis :: _synopsis
Synopsis string extracted from mancore :: 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 :: CmdManFile :: defaultinit
nitc :: DocCommand :: defaultinit
nitc :: CmdManSynopsis :: defaultinit
core :: Object :: defaultinit
nitc :: CmdEntity :: 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 :: CmdManSynopsis :: synopsis=
Synopsis string extracted from mannitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
class CmdManSynopsis
super CmdManFile
# Synopsis string extracted from man
var synopsis: nullable String
redef fun init_command do
var res = super
if not res isa CmdSuccess then return res
var mentity = self.mentity.as(not null)
var file = self.file.as(not null)
var lines = file.to_path.read_lines
var in_synopsis = false
for line in lines do
if in_synopsis and line.has_prefix(mentity.name) then
synopsis = line
break
end
if line != "# SYNOPSIS" then continue
in_synopsis = true
end
if synopsis == null then return new WarningNoManSynopsis(mentity)
return res
end
end
src/doc/commands/commands_main.nit:249,1--276,3
redef class CmdManSynopsis
redef fun to_json do
var obj = new JsonObject
obj["synopsis"] = synopsis
return obj
end
end
src/doc/templates/json_commands.nit:280,1--286,3
redef class CmdManSynopsis
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 = "Synopsis for `{mentity}`:"
if no_color == null or not no_color then
print title.bold
else
print title
end
print ""
var synopsis = self.synopsis
if synopsis != null then print synopsis
end
end
src/doc/term/term.nit:502,1--518,3