toodledo 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/lib/toodledo.rb +1 -1
- data/lib/toodledo/command_line/add_command.rb +7 -8
- data/lib/toodledo/command_line/base_command.rb +2 -7
- data/lib/toodledo/command_line/client.rb +25 -14
- data/lib/toodledo/command_line/complete_command.rb +6 -5
- data/lib/toodledo/command_line/delete_command.rb +7 -7
- data/lib/toodledo/command_line/edit_command.rb +7 -7
- data/lib/toodledo/command_line/hotlist_command.rb +4 -7
- data/lib/toodledo/command_line/list_command.rb +4 -7
- data/lib/toodledo/command_line/main_command.rb +10 -7
- data/lib/toodledo/command_line/parser_helper.rb +9 -7
- data/lib/toodledo/priority.rb +17 -0
- data/lib/toodledo/session.rb +1 -1
- metadata +69 -62
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.0.2 / 2008-02-14
|
2
|
+
|
3
|
+
* Fix a silly bug where whitespace wasn't stripped from edit, complete and delete.
|
4
|
+
* Enable interactive debug, and refactor the logging to be in client, not commands.
|
5
|
+
* Enable toodledo symbols to be anywhere in the string, not just before the task.
|
6
|
+
* Cleaner error messages if the task id is not found.
|
7
|
+
* Make sure failed commands exit with non-zero status.
|
8
|
+
|
1
9
|
== 1.0.1 / 2008-02-11
|
2
10
|
|
3
11
|
* Fix bug in client where priority filter was not being applied.
|
data/lib/toodledo.rb
CHANGED
@@ -12,17 +12,16 @@ module Toodledo
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def execute(args)
|
15
|
-
return if (args == nil)
|
16
|
-
|
17
|
-
if (client.debug?)
|
18
|
-
logger = Logger.new(STDOUT)
|
19
|
-
logger.level = Logger::DEBUG
|
20
|
-
end
|
21
|
-
|
22
|
-
Toodledo.begin(logger) do |session|
|
15
|
+
return if (args == nil)
|
16
|
+
Toodledo.begin(client.logger) do |session|
|
23
17
|
line = args.join(' ')
|
24
18
|
client.add_task(session, line)
|
25
19
|
end
|
20
|
+
|
21
|
+
return 0
|
22
|
+
rescue ItemNotFoundError => e
|
23
|
+
puts e.message
|
24
|
+
return -1
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
@@ -6,17 +6,12 @@ module Toodledo
|
|
6
6
|
def initialize(client, name, subtasks = false)
|
7
7
|
super(name, subtasks)
|
8
8
|
raise "Nil client!" if (client == nil)
|
9
|
-
@client = client
|
9
|
+
@client = client
|
10
10
|
end
|
11
11
|
|
12
12
|
def client
|
13
13
|
return @client
|
14
|
-
end
|
15
|
-
|
16
|
-
def logger
|
17
|
-
return @logger
|
18
|
-
end
|
19
|
-
|
14
|
+
end
|
20
15
|
end
|
21
16
|
end
|
22
17
|
end
|
@@ -45,6 +45,8 @@ module Toodledo
|
|
45
45
|
def initialize(userconfig=CONFIG_F, opts={})
|
46
46
|
@filters = {}
|
47
47
|
@debug = false
|
48
|
+
@logger = Logger.new(STDOUT)
|
49
|
+
@logger.level = Logger::FATAL
|
48
50
|
|
49
51
|
@userconfig = test(?e, userconfig) ? IO::read(userconfig) : CONFIG
|
50
52
|
@userconfig = YAML.load(@userconfig).merge(opts)
|
@@ -56,6 +58,15 @@ module Toodledo
|
|
56
58
|
|
57
59
|
def debug=(is_debug)
|
58
60
|
@debug = is_debug
|
61
|
+
if (@debug == true)
|
62
|
+
@logger.level = Logger::DEBUG
|
63
|
+
else
|
64
|
+
@logger.level = Logger::FATAL
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def logger
|
69
|
+
return @logger
|
59
70
|
end
|
60
71
|
|
61
72
|
#
|
@@ -166,18 +177,7 @@ module Toodledo
|
|
166
177
|
input = input.to_i
|
167
178
|
else
|
168
179
|
input = input.downcase
|
169
|
-
|
170
|
-
when 'negative'
|
171
|
-
input = Priority::NEGATIVE
|
172
|
-
when 'low'
|
173
|
-
input = Priority::LOW
|
174
|
-
when 'medium'
|
175
|
-
input = Priority::MEDIUM
|
176
|
-
when 'high'
|
177
|
-
input = Priority::HIGH
|
178
|
-
when 'top'
|
179
|
-
input = Priority::TOP
|
180
|
-
end
|
180
|
+
input = Priority.convert(input)
|
181
181
|
end
|
182
182
|
|
183
183
|
if (! Priority.valid?(input))
|
@@ -263,6 +263,7 @@ module Toodledo
|
|
263
263
|
# but that'll come by demand. Or patches. Fully documented patches, mmmm.
|
264
264
|
#
|
265
265
|
def hotlist(session, input)
|
266
|
+
logger.debug("hotlist: #{input}")
|
266
267
|
|
267
268
|
# See if there's input following the command.
|
268
269
|
context = parse_context(input)
|
@@ -386,18 +387,24 @@ module Toodledo
|
|
386
387
|
# task. Note that you must specify the ID here.
|
387
388
|
#
|
388
389
|
# edit *Action 12345
|
389
|
-
def edit_task(session, input)
|
390
|
+
def edit_task(session, input)
|
391
|
+
logger.debug("edit_task: #{input.inspect}")
|
392
|
+
|
390
393
|
context = parse_context(input)
|
391
394
|
folder = parse_folder(input)
|
392
395
|
goal = parse_goal(input)
|
393
396
|
task_id = parse_remainder(input)
|
394
397
|
|
395
|
-
|
398
|
+
logger.debug("edit_task: task_id = #{task_id}")
|
396
399
|
|
397
400
|
if (task_id == nil)
|
398
401
|
task_id = ask("Task ID?: ") { |q| q.readline = true }
|
399
402
|
end
|
400
403
|
|
404
|
+
task_id.strip!
|
405
|
+
|
406
|
+
params = { }
|
407
|
+
|
401
408
|
if (folder != nil)
|
402
409
|
params.merge!({ :folder => folder })
|
403
410
|
end
|
@@ -426,6 +433,8 @@ module Toodledo
|
|
426
433
|
task_id = ask("Task ID?: ") { |q| q.readline = true }
|
427
434
|
end
|
428
435
|
|
436
|
+
task_id.strip!
|
437
|
+
|
429
438
|
params = { :completed => 1 }
|
430
439
|
if (session.edit_task(task_id, params))
|
431
440
|
puts "Task #{task_id} completed."
|
@@ -445,6 +454,8 @@ module Toodledo
|
|
445
454
|
task_id = ask("Task ID?: ") { |q| q.readline = true }
|
446
455
|
end
|
447
456
|
|
457
|
+
task_id.strip!
|
458
|
+
|
448
459
|
if (session.delete_task(task_id))
|
449
460
|
puts "Task #{task_id} deleted."
|
450
461
|
else
|
@@ -8,15 +8,16 @@ module Toodledo
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def execute(args)
|
11
|
-
if (client.debug?)
|
12
|
-
logger = Logger.new(STDOUT)
|
13
|
-
logger.level = Logger::DEBUG
|
14
|
-
end
|
15
11
|
|
16
|
-
Toodledo.begin(logger) do |session|
|
12
|
+
Toodledo.begin(client.logger) do |session|
|
17
13
|
line = args.join(' ')
|
18
14
|
client.complete_task(session, line)
|
19
15
|
end
|
16
|
+
|
17
|
+
return 0
|
18
|
+
rescue ItemNotFoundError => e
|
19
|
+
puts e.message
|
20
|
+
return -1
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -8,16 +8,16 @@ module Toodledo
|
|
8
8
|
self.description = "Deletes a task from Toodledo."
|
9
9
|
end
|
10
10
|
|
11
|
-
def execute(args)
|
12
|
-
|
13
|
-
logger = Logger.new(STDOUT)
|
14
|
-
logger.level = Logger::DEBUG
|
15
|
-
end
|
16
|
-
|
17
|
-
Toodledo.begin(logger) do |session|
|
11
|
+
def execute(args)
|
12
|
+
Toodledo.begin(client.logger) do |session|
|
18
13
|
line = args.join(' ')
|
19
14
|
client.delete_task(session, line)
|
20
15
|
end
|
16
|
+
|
17
|
+
return 0
|
18
|
+
rescue ItemNotFoundError => e
|
19
|
+
puts e.message
|
20
|
+
return -1
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -10,15 +10,15 @@ module Toodledo
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def execute(args)
|
13
|
-
|
14
|
-
logger = Logger.new(STDOUT)
|
15
|
-
logger.level = Logger::DEBUG
|
16
|
-
end
|
17
|
-
|
18
|
-
Toodledo.begin(logger) do |session|
|
13
|
+
Toodledo.begin(client.logger) do |session|
|
19
14
|
line = args.join(' ')
|
20
|
-
client.edit_task(session, line)
|
15
|
+
return client.edit_task(session, line)
|
21
16
|
end
|
17
|
+
|
18
|
+
return 0
|
19
|
+
rescue ItemNotFoundError => e
|
20
|
+
puts e.message
|
21
|
+
return -1
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -7,16 +7,13 @@ module Toodledo
|
|
7
7
|
self.description = "Shows the hotlist in Toodledo."
|
8
8
|
end
|
9
9
|
|
10
|
-
def execute(args)
|
11
|
-
|
12
|
-
logger = Logger.new(STDOUT)
|
13
|
-
logger.level = Logger::DEBUG
|
14
|
-
end
|
15
|
-
|
16
|
-
Toodledo.begin(logger) do |session|
|
10
|
+
def execute(args)
|
11
|
+
Toodledo.begin(client.logger) do |session|
|
17
12
|
line = args.join(' ')
|
18
13
|
client.hotlist(session, line)
|
19
14
|
end
|
15
|
+
|
16
|
+
return 0
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
@@ -9,15 +9,12 @@ module Toodledo
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute(args)
|
12
|
-
|
13
|
-
logger = Logger.new(STDOUT)
|
14
|
-
logger.level = Logger::DEBUG
|
15
|
-
end
|
16
|
-
|
17
|
-
Toodledo.begin(logger) do |session|
|
12
|
+
Toodledo.begin(client.logger) do |session|
|
18
13
|
line = args.join(' ')
|
19
|
-
client.list_tasks(session, line)
|
14
|
+
return client.list_tasks(session, line)
|
20
15
|
end
|
16
|
+
|
17
|
+
return 0
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -13,13 +13,8 @@ module Toodledo
|
|
13
13
|
self.description = "The interactive command line client."
|
14
14
|
end
|
15
15
|
|
16
|
-
def execute(args)
|
17
|
-
|
18
|
-
logger = Logger.new(STDOUT)
|
19
|
-
logger.level = Logger::DEBUG
|
20
|
-
end
|
21
|
-
|
22
|
-
Toodledo.begin(logger) do |session|
|
16
|
+
def execute(args)
|
17
|
+
Toodledo.begin(client.logger) do |session|
|
23
18
|
command_loop(session)
|
24
19
|
end
|
25
20
|
end
|
@@ -129,6 +124,14 @@ module Toodledo
|
|
129
124
|
when /^unfilter/
|
130
125
|
client.unfilter()
|
131
126
|
|
127
|
+
when /debug/
|
128
|
+
client.debug = ! client.debug?
|
129
|
+
if (client.debug?)
|
130
|
+
logger.level = Logger::DEBUG
|
131
|
+
else
|
132
|
+
logger.level = Logger::FATAL
|
133
|
+
end
|
134
|
+
|
132
135
|
when /^quit/, /^exit/
|
133
136
|
break;
|
134
137
|
else
|
@@ -36,16 +36,18 @@ module Toodledo
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# Returns the bit after we've looked for *Folder, @Context & $Goal
|
39
|
-
def parse_remainder(
|
40
|
-
|
39
|
+
def parse_remainder(line)
|
40
|
+
|
41
|
+
input = line
|
42
|
+
|
43
|
+
# Strip out anything that isn't folder, goal or context.
|
41
44
|
for regexp in [ FOLDER_REGEXP, GOAL_REGEXP, CONTEXT_REGEXP]
|
42
|
-
|
43
|
-
next if (match == nil)
|
44
|
-
re_end = match.end(0)
|
45
|
-
biggest_pos = re_end if (biggest_pos < re_end)
|
45
|
+
input = input.sub(regexp, '')
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
input.strip!
|
49
|
+
|
50
|
+
return input
|
49
51
|
end
|
50
52
|
|
51
53
|
# Strips a string of [ and ] characters
|
data/lib/toodledo/priority.rb
CHANGED
@@ -30,5 +30,22 @@ module Toodledo
|
|
30
30
|
return false
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.convert(input)
|
34
|
+
case input
|
35
|
+
when 'negative'
|
36
|
+
return Priority::NEGATIVE
|
37
|
+
when 'low'
|
38
|
+
return Priority::LOW
|
39
|
+
when 'medium'
|
40
|
+
return Priority::MEDIUM
|
41
|
+
when 'high'
|
42
|
+
return Priority::HIGH
|
43
|
+
when 'top'
|
44
|
+
return Priority::TOP
|
45
|
+
else
|
46
|
+
raise ArgumentError.new("Unknown priority: #{input}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
33
50
|
end
|
34
51
|
end
|
data/lib/toodledo/session.rb
CHANGED
metadata
CHANGED
@@ -1,33 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: toodledo
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2008-02-11 00:00:00 -08:00
|
8
|
-
summary: A command line client and API to Toodledo
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: will@tersesystems.com
|
12
|
-
homepage: http://rubyforge.org/projects/toodledo
|
13
|
-
rubyforge_project: toodledo
|
14
|
-
description: "== DESCRIPTION: This is a Ruby API and client for http://toodledo.com, a task management website. It implements all of the calls from Toodledo's developer API, and provides a nice wrapper around the functionality. The client allows you to work with Toodledo from the command line. It will work in either interactive or command line mode. You can also use the client in your shell scripts, or use the API directly as part of a web application. Want an RSS feed? Want to have the Mac read out your top priority? It can all happen."
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.0.2
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Will Sargent
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-02-14 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cmdparse
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: highline
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: "0"
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: hoe
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.5.0
|
41
|
+
version:
|
42
|
+
description: "== DESCRIPTION: This is a Ruby API and client for http://toodledo.com, a task management website. It implements all of the calls from Toodledo's developer API, and provides a nice wrapper around the functionality. The client allows you to work with Toodledo from the command line. It will work in either interactive or command line mode. You can also use the client in your shell scripts, or use the API directly as part of a web application. Want an RSS feed? Want to have the Mac read out your top priority? It can all happen."
|
43
|
+
email: will@tersesystems.com
|
44
|
+
executables:
|
45
|
+
- toodledo
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files:
|
49
|
+
- History.txt
|
50
|
+
- Manifest.txt
|
51
|
+
- README.txt
|
31
52
|
files:
|
32
53
|
- CHANGELOG
|
33
54
|
- History.txt
|
@@ -59,46 +80,32 @@ files:
|
|
59
80
|
- test/parser_helper_test.rb
|
60
81
|
- test/session_test.rb
|
61
82
|
- test/toodledo_functional_test.rb
|
62
|
-
|
63
|
-
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://rubyforge.org/projects/toodledo
|
85
|
+
post_install_message:
|
64
86
|
rdoc_options:
|
65
87
|
- --main
|
66
88
|
- README.txt
|
67
|
-
|
68
|
-
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
-
|
73
|
-
|
74
|
-
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
version:
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
102
|
+
version:
|
75
103
|
requirements: []
|
76
104
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 0.0.0
|
86
|
-
version:
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: highline
|
89
|
-
version_requirement:
|
90
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
91
|
-
requirements:
|
92
|
-
- - ">"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: 0.0.0
|
95
|
-
version:
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: hoe
|
98
|
-
version_requirement:
|
99
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.5.0
|
104
|
-
version:
|
105
|
+
rubyforge_project: toodledo
|
106
|
+
rubygems_version: 1.0.1
|
107
|
+
signing_key:
|
108
|
+
specification_version: 2
|
109
|
+
summary: A command line client and API to Toodledo
|
110
|
+
test_files: []
|
111
|
+
|