INNER CODE UNIT · Ruby
files
busyloop/lolcat · lib/lolcat/cat.rb:101
files = ARGV.empty? ? [:stdin] : ARGV[0..-1]
files.each do |file|
fd = $stdin if file == '-' or file == :stdin
begin
fd = File.open(file, "r") unless fd == $stdin
if $stdout.tty? or opts[:force]
Lol.cat fd, opts
else
if fd.tty?
fd.each do |line|
$stdout.write(line)
end
else
IO.copy_stream(fd, $stdout)
end
end
rescue Errno::ENOENT