RosettaCodeData/Task/Take-notes-on-the-command-line/Seed7/take-notes-on-the-command-line.seed7
2023-07-01 13:44:08 -04:00

23 lines
586 B
Text

$ include "seed7_05.s7i";
$ include "getf.s7i";
$ include "time.s7i";
const string: noteFileName is "NOTES.TXT";
const proc: main is func
local
var file: note is STD_NULL;
begin
if length(argv(PROGRAM)) = 0 then
# write NOTES.TXT
write(getf(noteFileName));
else
# Write date & time to NOTES.TXT, and then arguments
note := open(noteFileName, "a");
if note <> STD_NULL then
writeln(note, truncToSecond(time(NOW)));
writeln(note, "\t" <& join(argv(PROGRAM), " "));
close(note);
end if;
end if;
end func;