Property definitions

nitc $ CmdUML :: defaultinit
# UML command
#
# Return an UML diagram about a `mentity`.
class CmdUML
	super CmdEntity
	super CmdGraph

	autoinit(model, mainmodule, filter, mentity, mentity_name, format, uml)

	# UML model to return
	var uml: nullable UMLModel = null is optional, writable

	redef fun init_command do
		if uml != null then return new CmdSuccess

		var res = super
		if not res isa CmdSuccess then return res
		var mentity = self.mentity.as(not null)

		if mentity isa MClassDef then mentity = mentity.mclass
		if mentity isa MClass or mentity isa MModule then
			uml = new UMLModel(model, mainmodule, filter)
		else
			return new WarningNoUML(mentity)
		end
		return res
	end

	redef fun render do
		var uml = self.uml
		if uml == null then return null
		if mentity isa MClass then
			dot = uml.generate_class_uml.write_to_string
		else if mentity isa MModule then
			dot = uml.generate_package_uml.write_to_string
		end
		return super
	end
end
src/doc/commands/commands_graph.nit:90,1--128,3