nitc :: CmdManSynopsis :: defaultinit
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