[TxMt] [TextMate] Help With Ruby Command

Kjell Olsen kjell at station11.net
Tue Oct 26 21:38:22 UTC 2004

Ok, thanks everyone who helped - I got it working.  I touched up the 
ruby script, now it adds in the date and the from file on the same 
line.  Here it is:

ruby <<END
from = File.basename("$TM_FILEPATH","")
time_now = Time.now
time = time_now.strftime("%H:%M:%S")

task.gsub!("^. ","* [#{time}] ")
task += " {#{ from}}"

    file.puts task

I have standard input set to none, because I instead use 
$TM_CURRENT_LINE to get the line that I want.  But because this doesn't 
delete the line that has been completed, I recorded a macro which 
executes this command and then completely deletes the line that the 
cursor is on (control-shift-left arrow, shift-left arrow) and this 
works great.

I still have some work to do on it though: I want to have the completed 
files separated by day and month automatically and eventually want to 
ruby out reports of time spent on certain actions.  Also I'm going to 
try and figure out how to have the list reverse chronologically, with 
the most recent completed items at the top.  Should be a fun ruby 
exercise!  Thanks for all your help - and if you know how to do either 
of my two things, feel free to give me some more.

More information about the textmate mailing list