nitc :: ProjTree :: defaultinit
class ProjTree
super OrderedTree[MConcern]
var opt_paths = false
var tc: ToolContext
redef fun display(o)
do
if o isa MGroup then
if opt_paths then
return o.filepath.as(not null)
else
var d = ""
if o.mdoc != null then
if tc.opt_no_color.value then
d = ": {o.mdoc.content.first}"
else
d = ": {o.mdoc.content.first.green}"
end
end
if tc.opt_no_color.value then
return "{o.name}{d} ({o.filepath.to_s})"
else
return "{o.name}{d} ({o.filepath.yellow})"
end
end
else if o isa MModule then
if opt_paths then
return o.filepath.as(not null)
else
var d = ""
var dd = ""
if o.mdoc != null then
if tc.opt_no_color.value then
d = ": {o.mdoc.content.first}"
else
d = ": {o.mdoc.content.first.green}"
end
end
if not o.in_importation.direct_greaters.is_empty then
var ms = new Array[String]
for m in o.in_importation.direct_greaters do
if m.mgroup.mpackage == o.mgroup.mpackage then
ms.add m.name
else
ms.add m.full_name
end
end
if tc.opt_no_color.value then
dd = " ({ms.join(" ")})"
else
dd = " ({ms.join(" ")})".light_gray
end
end
if tc.opt_no_color.value then
return "{o.name.bold}{d} ({o.filepath.to_s}){dd}"
else
return "{o.name.bold}{d} ({o.filepath.yellow}){dd}"
end
end
else
abort
end
end
end
src/nitls.nit:24,1--88,3