class Console::Terminal::Formatter::Spawn

Format a spawn event, including the command and arguments.

def chdir_string(options)

Generate a string to represent the working directory.
def chdir_string(options)
	if options and chdir = options[:chdir]
		" in #{chdir}"
	end
end

def format(event, stream, verbose: false, width: 80)

@parameter width [Integer] The width of the progress bar.
@parameter verbose [Boolean] Whether to include additional information.
@parameter stream [IO] The stream to write the formatted event to.
@parameter event [Hash] The event to format.

Format the given event.
def format(event, stream, verbose: false, width: 80)
	environment, arguments, options = event.values_at(:environment, :arguments, :options)
	
	arguments = arguments.flatten.collect(&:to_s)
	
	stream.puts "#{@terminal[:spawn_command]}#{arguments.join(' ')}#{@terminal.reset}#{chdir_string(options)}"
	
	if verbose and environment
		environment.each do |key, value|
			stream.puts "export #{key}=#{value}"
		end
	end
end

def initialize(terminal)

Parameters:
  • terminal (Terminal::Text) -- The terminal to use for formatting.
def initialize(terminal)
	@terminal = terminal
	@terminal[:spawn_command] ||= @terminal.style(:blue, nil, :bold)
end