nitc :: CmdEntityFile :: defaultinit
abstract class CmdEntityFile
super CmdEntity
# File path
var file: nullable String = null is writable
# Accepted file names
fun file_names: Array[String] is abstract
# Init file related data
fun init_file: CmdMessage do
var mentity = self.mentity.as(not null)
var source_file = mentity.location.file
if source_file == null then return throw_warning
for file_name in file_names do
var file = source_file.filename / file_name
if not file.file_exists then continue
self.file = file
break
end
if file == null then return throw_warning
return new CmdSuccess
end
redef fun init_command do
var res = super
if not res isa CmdSuccess then return res
return init_file
end
fun throw_warning: CmdWarning is abstract
end
src/doc/commands/commands_ini.nit:262,1--297,3