diff --git a/IDEAS_FR.txt b/IDEAS.FR similarity index 100% rename from IDEAS_FR.txt rename to IDEAS.FR diff --git a/TODO b/TODO new file mode 100644 index 0000000..3111912 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +[1] Code the done or archive created:"Thu Jun 11 16:07:47 +0200 2009" +[2] Code the filter command created:"Thu Jun 11 16:07:59 +0200 2009" +[3] Code the automatic sort command (it appear to be a complex function) created:"Thu Jun 11 16:08:27 +0200 2009" +[4] Code the modify and extend commands /1\ created:"Thu Jun 11 16:09:24 +0200 2009" diff --git a/ytodo.rb b/ytodo.rb index 86d864d..5f5e6d1 100644 --- a/ytodo.rb +++ b/ytodo.rb @@ -9,7 +9,7 @@ require 'readline' listeEnvVariables=[] autosave=true listeEnvVariables<<='autosave' -defaultTaskFile="tasks.ytd" +defaultTaskFile="TODO" listeEnvVariables<<='defaultTaskFile' def showVariable (varname) @@ -18,6 +18,20 @@ def showVariable (varname) end if __FILE__ == $0: + + # trap the ^C + trap('INT'){ + if not autosave: + answer=Readline.readline('Do you want to save your changes? (y/n)',false) + if not answer =~ /^no?$/: + puts "Changes saved in #{defaultTaskFile}" + todoList.save defaultTaskFile + end + end + puts "\nGood Bye... See you later for another safe and productive day" + exit 0 + } + todoList=TodoList.new todoList.load defaultTaskFile while entry = Readline.readline('> ',true): @@ -49,26 +63,25 @@ if __FILE__ == $0: # Vim tips not to loose any command # :r!grep when ytodo.rb puts ' - a + add add an entry - cmd , ! launch external command - h,help show this message - l,list list the tasks - load,=> [filename] load the tasks from file filename - q,quit quit - s,save [filename] save the tasks to file filename - show [conf key] show the value of a configuration variable + COMMANDS +a,+,add add an entry +cmd,! launch external command +h,help show this message +l,list list the tasks +load,=> [filename] load the tasks from file filename +q,quit quit +s,save [filename] save the tasks to file filename +show [conf key] show the value of a configuration variable - Tips: - you can also add an entry if the first word is not a command - and the entry is longer than 10 characters (most of time it is). + TIPS +If your entrie is longer than 10 character long and the first +word is not a command. The entrie is added to task. - Reminder: - @Context [project] (a note) {tag} - priority: !! ! "nothing" ? ?? - date: - #due_date - #start_date,due_date - for example: #tomorrow,"in 4 days" + REMINDER + @Context [project] (a note) {tag} +Priority: (higher) !! ! "nothing" ? ?? (lower) +Date: #due_date, #start_date,due_date + example: #tomorrow,"in 4 days" ' when /^(show)( (.*))?$/ varname=$3 @@ -108,6 +121,9 @@ if __FILE__ == $0: # if the entry is more than 10 characters long # and not recognized then it is a new entry todoList.addTask( Task.new(entry) ) + if autosave: + todoList.save defaultTaskFile + end end end end