module Hoe::RakeHelpers

def ansi_code( *attributes )

## Create a string that contains the ANSI codes specified and return it
def ansi_code( *attributes )
	attributes.flatten!
	attributes.collect! {|at| at.to_s }
	# $stderr.puts "Returning ansicode for TERM = %p: %p" %
	#		[ ENV['TERM'], attributes ]
	return '' unless /(?:vt10[03]|xterm(?:-color)?|linux|screen)/i =~ ENV['TERM']
	attributes = ANSI_ATTRIBUTES.values_at( *attributes ).compact.join(';')
	# $stderr.puts "	attr is: %p" % [attributes]
	if attributes.empty?
		return ''
	else
		return "\e[%sm" % attributes
	end
end