goot 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -6
- data/lib/goot/cli.rb +35 -28
- data/lib/goot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19405728299c2d9c69aeabe0771dceb708fcd515
|
4
|
+
data.tar.gz: a85026513751a851579ddce2d2c9da25286cd690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3963e9c221420229bb37fe27474f801537b6d42c5a7b40b0faffb92f799b49760c95d69181fcab37d785a122912b605d5e39da93561cbabe95d18d1cc3a5b34b
|
7
|
+
data.tar.gz: b0004254176d64110e092b359bc94f859b5072553f2df504034a8d35d7530b56a8e9bbba7cc5de7ba9bb5b298c05757233847e01c084bf8d72266eaae71619b8
|
data/README.md
CHANGED
@@ -8,18 +8,47 @@ A command-line interface to Google Tasks das ist goot.
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
|
11
|
+
Prints a summary of tasklists and their indexes
|
12
|
+
|
12
13
|
goot summary
|
13
14
|
goot s
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
goot
|
16
|
+
Lists tasks in a given list (0 by default)
|
17
|
+
|
18
|
+
goot ls
|
19
|
+
|
20
|
+
Toggle a task by index
|
18
21
|
|
19
|
-
# Toggle a task by index
|
20
22
|
goot toggle 3
|
21
23
|
goot t 3
|
24
|
+
goot t 3 4 6
|
25
|
+
|
26
|
+
Clear completed tasks
|
22
27
|
|
23
|
-
# Clear completed tasks
|
24
28
|
goot clear
|
25
29
|
goot c
|
30
|
+
|
31
|
+
Delete a task
|
32
|
+
|
33
|
+
goot delete 3
|
34
|
+
goot d 3
|
35
|
+
goot d 3 4 6
|
36
|
+
|
37
|
+
Add a task
|
38
|
+
|
39
|
+
goot add "foo"
|
40
|
+
goot a "foo"
|
41
|
+
goot a "foo" "bar" "baz"
|
42
|
+
|
43
|
+
Move a task
|
44
|
+
|
45
|
+
goot move 3 -a 1
|
46
|
+
goot m 2 -p 0
|
47
|
+
|
48
|
+
Add a new tasklist
|
49
|
+
|
50
|
+
goot listadd "New list"
|
51
|
+
|
52
|
+
Delete a tasklist
|
53
|
+
|
54
|
+
goot listdelete 0
|
data/lib/goot/cli.rb
CHANGED
@@ -6,9 +6,9 @@ class GoogleTasks::CLI < Thor
|
|
6
6
|
@api = GoogleTasks::GoogleAPI.new
|
7
7
|
end
|
8
8
|
|
9
|
-
desc "
|
9
|
+
desc "ls", "Displays available tasks for a given tasklist"
|
10
10
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
11
|
-
def
|
11
|
+
def ls
|
12
12
|
tab = ' '
|
13
13
|
depths = {}
|
14
14
|
|
@@ -40,27 +40,29 @@ class GoogleTasks::CLI < Thor
|
|
40
40
|
|
41
41
|
desc "toggle INDEX", "Toggles a given task"
|
42
42
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
43
|
-
def toggle(
|
43
|
+
def toggle(*indices)
|
44
44
|
tasklist = @api.get_tasklist(options[:tasklist])
|
45
45
|
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
47
|
+
indices.each do |index|
|
48
|
+
task = tasks[index.to_i]
|
49
|
+
task['status'] = task['completed'].nil? ? 'completed' : 'needsAction'
|
50
|
+
task.delete 'completed'
|
51
|
+
@api.update_task(tasklist, task)
|
52
|
+
|
53
|
+
toggle_children = lambda do |parent|
|
54
|
+
children = tasks.select { |t| t['parent'] == parent['id'] }
|
55
|
+
children.each do |t|
|
56
|
+
t['status'] = task['status']
|
57
|
+
t.delete 'completed'
|
58
|
+
@api.update_task(tasklist, t)
|
59
|
+
toggle_children.call(t)
|
60
|
+
end
|
59
61
|
end
|
62
|
+
toggle_children.call(task)
|
60
63
|
end
|
61
|
-
toggle_children.call(task)
|
62
64
|
|
63
|
-
invoke :
|
65
|
+
invoke :ls, [], :tasklist => options[:tasklist]
|
64
66
|
end
|
65
67
|
|
66
68
|
desc "clear", "Clears completed tasks"
|
@@ -69,18 +71,20 @@ class GoogleTasks::CLI < Thor
|
|
69
71
|
tasklist = @api.get_tasklist(options[:tasklist])
|
70
72
|
@api.clear_tasks(tasklist)
|
71
73
|
|
72
|
-
invoke :
|
74
|
+
invoke :ls, [], :tasklist => options[:tasklist]
|
73
75
|
end
|
74
76
|
|
75
77
|
desc "delete INDEX", "Deletes a given task"
|
76
78
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
77
|
-
def delete(
|
79
|
+
def delete(*indices)
|
78
80
|
tasklist = @api.get_tasklist(options[:tasklist])
|
79
81
|
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
80
82
|
|
81
|
-
|
83
|
+
indices.each do |index|
|
84
|
+
@api.delete_task(tasklist, tasks[index.to_i])
|
85
|
+
end
|
82
86
|
|
83
|
-
invoke :
|
87
|
+
invoke :ls, [], :tasklist => options[:tasklist]
|
84
88
|
end
|
85
89
|
|
86
90
|
desc "move INDEX", "Moves a given task"
|
@@ -96,24 +100,27 @@ class GoogleTasks::CLI < Thor
|
|
96
100
|
|
97
101
|
@api.move_task(tasklist, tasks[index.to_i], previous, parent)
|
98
102
|
|
99
|
-
invoke :
|
103
|
+
invoke :ls, [], :tasklist => options[:tasklist]
|
100
104
|
end
|
101
105
|
|
102
106
|
desc "add NAME", "Adds a task"
|
103
107
|
method_option :after, :aliases => "-a", :type => :numeric
|
104
108
|
method_option :parent, :aliases => "-p", :type => :numeric
|
105
109
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
106
|
-
def add(
|
110
|
+
def add(*names)
|
107
111
|
tasklist = @api.get_tasklist(options[:tasklist])
|
108
112
|
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
109
|
-
task = { :title => name }
|
110
113
|
|
111
|
-
|
112
|
-
|
114
|
+
names.each do |name|
|
115
|
+
task = { :title => name }
|
113
116
|
|
114
|
-
|
117
|
+
previous = tasks[options[:after].to_i] if !options[:after].nil?
|
118
|
+
parent = tasks[options[:parent].to_i] if !options[:parent].nil?
|
119
|
+
|
120
|
+
@api.insert_task(tasklist, task, previous, parent)
|
121
|
+
end
|
115
122
|
|
116
|
-
invoke :
|
123
|
+
invoke :ls, [], :tasklist => options[:tasklist]
|
117
124
|
end
|
118
125
|
|
119
126
|
desc "listadd NAME", "Adds a new tasklist"
|
data/lib/goot/version.rb
CHANGED