RosettaCodeData/Task/Take-notes-on-the-command-line/Ruby/take-notes-on-the-command-l...

7 lines
173 B
Ruby

notes = 'NOTES.TXT'
if ARGV.empty?
File.copy_stream(notes, $stdout) rescue nil
else
File.open(notes, 'a') {|file| file.puts "%s\n\t%s" % [Time.now, ARGV.join(' ')]}
end