nitc :: CmdAncestors :: defaultinit
# MEntity ancestors command
#
# Retrieve all the ancestors (direct and indirect) of a MEntity.
class CmdAncestors
super CmdInheritance
# Include direct parents in the ancestors list
#
# Default is `true`.
var parents = true is optional, writable
redef fun init_results do
if results != null then return new CmdSuccess
var res = super
if not res isa CmdSuccess then return res
var mentity = self.mentity.as(not null)
var ancestors = mentity.collect_ancestors(mainmodule, filter).to_a
if parents then
results = ancestors
return res
end
var parents = mentity.collect_parents(mainmodule, filter)
var mentities = new HashSet[MEntity]
for ancestor in ancestors do
if not parents.has(ancestor) then mentities.add ancestor
end
results = mentities.to_a
return res
end
end
src/doc/commands/commands_model.nit:127,1--159,3