Property definitions

nitc $ DocCommand :: defaultinit
# Documentation command
#
# An abstract command that works on a Model.
#
# Since they are used by a wide variety of clients, initialization of DocCommands
# works in two steps.
#
# First, you pass the data you already have to the command at init:
# ~~~nitish
# var c1 = new CmdEntity(view, mentity_name = "Array")
# var c2 = new CmdEntity(view, mentity = my_entity)
# ~~~
#
# Then, you call `init_command` to initialize the missing field from the stub data:
# ~~~nitish
# var r1 = c1.init_command
# assert c1.mentity != null
# assert r1 isa CmdSuccess
#
# var r2 = c2.init_command
# assert c2.mentity_name != null
# assert r2 isa CmdSuccess
# ~~~
#
# See `init_command` for more details about the returned statuses.
abstract class DocCommand

	# Model to retrieve data for
	var model: Model

	# ModelFilter to apply if any
	var filter: nullable ModelFilter

	# Initialize the command
	#
	# Returns a command message that gives the status of the command initialization.
	#
	# There is 3 categories of messages:
	# * `CmdSuccess`: when the command that initialized correctly;
	# * `CmdError`: when the command cannot be initialized;
	# * `CmdWarning`: when something is wrong with the command but a result still can be produced.
	#
	# Warnings are generally used to distinguish empty list or mdoc from no data at all.
	fun init_command: CmdMessage do return new CmdSuccess

	# Return a new filter for that command execution.
	fun cmd_filter: ModelFilter do
		var filter = self.filter
		if filter == null then return new ModelFilter
		return new ModelFilter.from(filter)
	end
end
src/doc/commands/commands_base.nit:28,1--79,3