Better help, new todo list, trap ^C
The file TODO list the list of task to be done for the project using YTodo of course. Run with ruby ytodo.rb
This commit is contained in:
parent
6983132d31
commit
0934903ef4
3 changed files with 39 additions and 19 deletions
4
TODO
Normal file
4
TODO
Normal file
|
@ -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"
|
40
ytodo.rb
40
ytodo.rb
|
@ -9,7 +9,7 @@ require 'readline'
|
||||||
listeEnvVariables=[]
|
listeEnvVariables=[]
|
||||||
autosave=true
|
autosave=true
|
||||||
listeEnvVariables<<='autosave'
|
listeEnvVariables<<='autosave'
|
||||||
defaultTaskFile="tasks.ytd"
|
defaultTaskFile="TODO"
|
||||||
listeEnvVariables<<='defaultTaskFile'
|
listeEnvVariables<<='defaultTaskFile'
|
||||||
|
|
||||||
def showVariable (varname)
|
def showVariable (varname)
|
||||||
|
@ -18,6 +18,20 @@ def showVariable (varname)
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $0:
|
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=TodoList.new
|
||||||
todoList.load defaultTaskFile
|
todoList.load defaultTaskFile
|
||||||
while entry = Readline.readline('> ',true):
|
while entry = Readline.readline('> ',true):
|
||||||
|
@ -49,8 +63,9 @@ if __FILE__ == $0:
|
||||||
# Vim tips not to loose any command
|
# Vim tips not to loose any command
|
||||||
# :r!grep when ytodo.rb
|
# :r!grep when ytodo.rb
|
||||||
puts '
|
puts '
|
||||||
a + add add an entry
|
COMMANDS
|
||||||
cmd <cmd>, !<cmd> launch external command
|
a,+,add <entry> add an entry
|
||||||
|
cmd,! <cmd> launch external command
|
||||||
h,help show this message
|
h,help show this message
|
||||||
l,list list the tasks
|
l,list list the tasks
|
||||||
load,=> [filename] load the tasks from file filename
|
load,=> [filename] load the tasks from file filename
|
||||||
|
@ -58,17 +73,15 @@ if __FILE__ == $0:
|
||||||
s,save [filename] save the tasks to file filename
|
s,save [filename] save the tasks to file filename
|
||||||
show [conf key] show the value of a configuration variable
|
show [conf key] show the value of a configuration variable
|
||||||
|
|
||||||
Tips:
|
TIPS
|
||||||
you can also add an entry if the first word is not a command
|
If your entrie is longer than 10 character long and the first
|
||||||
and the entry is longer than 10 characters (most of time it is).
|
word is not a command. The entrie is added to task.
|
||||||
|
|
||||||
Reminder:
|
REMINDER
|
||||||
@Context [project] (a note) {tag}
|
@Context [project] (a note) {tag}
|
||||||
priority: !! ! "nothing" ? ??
|
Priority: (higher) !! ! "nothing" ? ?? (lower)
|
||||||
date:
|
Date: #due_date, #start_date,due_date
|
||||||
#due_date
|
example: #tomorrow,"in 4 days"
|
||||||
#start_date,due_date
|
|
||||||
for example: #tomorrow,"in 4 days"
|
|
||||||
'
|
'
|
||||||
when /^(show)( (.*))?$/
|
when /^(show)( (.*))?$/
|
||||||
varname=$3
|
varname=$3
|
||||||
|
@ -108,6 +121,9 @@ if __FILE__ == $0:
|
||||||
# if the entry is more than 10 characters long
|
# if the entry is more than 10 characters long
|
||||||
# and not recognized then it is a new entry
|
# and not recognized then it is a new entry
|
||||||
todoList.addTask( Task.new(entry) )
|
todoList.addTask( Task.new(entry) )
|
||||||
|
if autosave:
|
||||||
|
todoList.save defaultTaskFile
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue