RosettaCodeData/Task/Take-notes-on-the-command-line/Phix/take-notes-on-the-command-line.phix
2016-12-05 23:44:36 +01:00

20 lines
511 B
Text

constant cmd = command_line()
constant filename = "notes.txt"
integer fn
object line
if length(cmd)<3 then
fn = open(filename,"r")
if fn!=-1 then
while 1 do
line = gets(fn)
if atom(line) then exit end if
puts(1,line)
end while
close(fn)
end if
else
fn = open(filename,"a") -- if such file doesn't exist it will be created
printf(fn,"%d-%02d-%02d %d:%02d:%02d\n",date())
printf(fn,"\t%s\n",join(cmd[3..$]))
close(fn)
end if