gwtf 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/gwtf.rb +1 -1
- data/lib/gwtf/commands/list_command.rb +6 -0
- data/lib/gwtf/commands/remind_command.rb +38 -12
- data/lib/gwtf/version.rb +1 -1
- metadata +4 -4
data/lib/gwtf.rb
CHANGED
@@ -22,6 +22,8 @@ command [:list, :ls, :l] do |c|
|
|
22
22
|
longest_name = projects.map{|p| p.length}.max
|
23
23
|
|
24
24
|
projects.each_with_index do |project, idx|
|
25
|
+
next if project == "reminders"
|
26
|
+
|
25
27
|
puts "Items in all projects:\n\n" if idx == 0
|
26
28
|
|
27
29
|
items = Gwtf::Items.new(File.join(global_options[:data], project), project)
|
@@ -43,6 +45,8 @@ command [:list, :ls, :l] do |c|
|
|
43
45
|
|
44
46
|
elsif options[:due]
|
45
47
|
Gwtf.projects(global_options[:data]).each do |project|
|
48
|
+
next if project == "reminders"
|
49
|
+
|
46
50
|
items = Gwtf::Items.new(File.join(global_options[:data], project), project)
|
47
51
|
|
48
52
|
items.each_item do |item|
|
@@ -52,6 +56,8 @@ command [:list, :ls, :l] do |c|
|
|
52
56
|
|
53
57
|
elsif options[:overview]
|
54
58
|
Gwtf.projects(global_options[:data]).each do |project|
|
59
|
+
next if project == "reminders"
|
60
|
+
|
55
61
|
items = Gwtf::Items.new(File.join(global_options[:data], project), project)
|
56
62
|
|
57
63
|
if items.item_ids.size > 0
|
@@ -1,13 +1,12 @@
|
|
1
|
-
desc '
|
2
|
-
arg_name 'id [at time specification]'
|
1
|
+
desc 'Manage or send reminders about an item'
|
3
2
|
long_desc <<EOF
|
4
|
-
|
5
|
-
add an at() job using the supplied at time specification.
|
3
|
+
Schedule a reminder for an existing task: gwtf remind 10 now +5 minutes
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
Send a reminder for an existing task immediately: gwtf remind 10 --send
|
6
|
+
|
7
|
+
Add a new item to the reminders project and schedule a reminder: gwtf remind --at="noon tomorrow" have lunch
|
8
|
+
|
9
|
+
Time specifications are in at(1) format.
|
11
10
|
EOF
|
12
11
|
|
13
12
|
command [:remind, :rem] do |c|
|
@@ -27,17 +26,44 @@ command [:remind, :rem] do |c|
|
|
27
26
|
c.default_value false
|
28
27
|
c.switch [:ifopen]
|
29
28
|
|
29
|
+
c.desc "at(1) time specification for the reminder to be sent"
|
30
|
+
c.default_value nil
|
31
|
+
c.flag [:at]
|
32
|
+
|
30
33
|
c.action do |global_options,options,args|
|
31
34
|
raise "Please supply an item ID to remind about" if args.empty?
|
32
35
|
|
36
|
+
STDOUT.sync
|
37
|
+
|
33
38
|
unless options[:send]
|
34
|
-
|
39
|
+
if args.first =~ /^\d+$/ # got an item id, schedule a reminder
|
40
|
+
unless options[:at]
|
41
|
+
raise "Please specify a valid at(1) time specification with --at after the item id" unless args.size > 2
|
42
|
+
options[:at] = args[1..-1].join(" ")
|
43
|
+
end
|
44
|
+
|
45
|
+
print "Creating reminder at job for item #{args.first}: "
|
35
46
|
|
36
|
-
|
47
|
+
@items.load_item(args.first).schedule_reminer(options[:at], options[:recipient], options[:done], options[:ifopen])
|
37
48
|
|
38
|
-
|
49
|
+
else # new reminder in the 'reminders' project
|
50
|
+
raise "Please specify an at(1) time specification" unless options[:at]
|
51
|
+
raise "Please specify a subject for the reminder item" if args.empty?
|
39
52
|
|
40
|
-
|
53
|
+
project_dir = File.join(global_options[:data], "reminders")
|
54
|
+
Gwtf::Items.setup(project_dir) unless File.directory?(project_dir)
|
55
|
+
|
56
|
+
items = Gwtf::Items.new(project_dir, "reminders")
|
57
|
+
reminder = items.new_item
|
58
|
+
reminder.subject = args.join(" ")
|
59
|
+
|
60
|
+
print "Creating reminder at job for item #{reminder.item_id}: "
|
61
|
+
reminder.schedule_reminer(options[:at], options[:recipient], true, true)
|
62
|
+
|
63
|
+
reminder.save
|
64
|
+
|
65
|
+
puts reminder.to_s
|
66
|
+
end
|
41
67
|
else
|
42
68
|
item = @items.load_item(args.first)
|
43
69
|
|
data/lib/gwtf/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gwtf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- R.I.Pienaar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|