class Console::Event::Spawn

def self.for(*arguments, **options)

def self.for(*arguments, **options)
	if arguments.first.is_a?(Hash)
		self.new(*arguments, **options)
	else
		self.new(nil, arguments, **options)
	end
end

def self.register(terminal)

def self.register(terminal)
	terminal[:shell_command] ||= terminal.style(:blue, nil, :bold)
end

def chdir_string(options)

def chdir_string(options)
	if options and chdir = options[:chdir]
		" in #{chdir}"
	end
end

def format(output, terminal, verbose)

def format(output, terminal, verbose)
	arguments = @arguments.flatten.collect(&:to_s)
	
	output.puts "  #{terminal[:shell_command]}#{arguments.join(' ')}#{terminal.reset}#{chdir_string(options)}"
	
	if verbose and @environment
		@environment.each do |key, value|
			output.puts "    export #{key}=#{value}"
		end
	end
end

def initialize(environment, *arguments, **options)

def initialize(environment, *arguments, **options)
	@environment = environment
	@arguments = arguments
	@options = options
end