Property definitions

nitc $ CmdCatalogPerson :: defaultinit
# Retrieve a person from the catalog
class CmdCatalogPerson
	super CmdCatalog

	# Person to retrieve
	#
	# You can also pass a `person_name`.
	var person: nullable Person = null is optional, writable

	# Name of the person to retrieve
	#
	# You can also pass a `person` instance.
	var person_name: nullable String = null is optional, writable

	# Initialize the `person` result
	fun init_person: CmdMessage do
		var person = self.person
		if person != null then
			person_name = person.name
			return new CmdSuccess
		end

		var name = self.person_name
		if name == null then return new ErrorNoPerson
		if not catalog.name2person.has_key(name) then return new ErrorPersonNotFound(name)
		self.person = catalog.name2person[name]
		return new CmdSuccess
	end

	redef fun init_command do
		init_person
		return super
	end
end
src/doc/commands/commands_catalog.nit:236,1--269,3