goot 0.0.12 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -6
  3. data/lib/goot/cli.rb +35 -28
  4. data/lib/goot/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 624fa57fb1f3eb82e6b225bf187090839b168741
4
- data.tar.gz: 33998e10ddadbb42a7a143b4424f2961f0516d0a
3
+ metadata.gz: 19405728299c2d9c69aeabe0771dceb708fcd515
4
+ data.tar.gz: a85026513751a851579ddce2d2c9da25286cd690
5
5
  SHA512:
6
- metadata.gz: ee3b00654d6241c27d1edc2331f9defdf1518feab1c0d39aa25ea87c7c6b666213d0dc29d5f58953b3a17eeda85ae6e4df12e6f8742d61539c4ef00649a16d9d
7
- data.tar.gz: bf11b0e243e3cdc1bdaa17d94e80a289f47671e065bf86d9dda669a385a59fd081fc1d9b0a394a27e4c87575e289ce149420a2bf083921f2768f04d75f286538
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
- # Prints a summary of tasklists and their indexes
11
+ Prints a summary of tasklists and their indexes
12
+
12
13
  goot summary
13
14
  goot s
14
15
 
15
- # Lists tasks in a given list (0 by default)
16
- goot list
17
- goot l
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
@@ -6,9 +6,9 @@ class GoogleTasks::CLI < Thor
6
6
  @api = GoogleTasks::GoogleAPI.new
7
7
  end
8
8
 
9
- desc "list", "Displays available tasks for a given tasklist"
9
+ desc "ls", "Displays available tasks for a given tasklist"
10
10
  method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
11
- def list
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(index)
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
- task = tasks[index.to_i]
48
- task['status'] = task['completed'].nil? ? 'completed' : 'needsAction'
49
- task.delete 'completed'
50
- @api.update_task(tasklist, task)
51
-
52
- toggle_children = lambda do |parent|
53
- children = tasks.select { |t| t['parent'] == parent['id'] }
54
- children.each do |t|
55
- t['status'] = task['status']
56
- t.delete 'completed'
57
- @api.update_task(tasklist, t)
58
- toggle_children.call(t)
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 :list, [], :tasklist => options[:tasklist]
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 :list, [], :tasklist => options[:tasklist]
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(index)
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
- @api.delete_task(tasklist, tasks[index.to_i])
83
+ indices.each do |index|
84
+ @api.delete_task(tasklist, tasks[index.to_i])
85
+ end
82
86
 
83
- invoke :list, [], :tasklist => options[:tasklist]
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 :list, [], :tasklist => options[:tasklist]
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(name)
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
- previous = tasks[options[:after].to_i] if !options[:after].nil?
112
- parent = tasks[options[:parent].to_i] if !options[:parent].nil?
114
+ names.each do |name|
115
+ task = { :title => name }
113
116
 
114
- @api.insert_task(tasklist, task, previous, parent)
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 :list, [], :tasklist => options[:tasklist]
123
+ invoke :ls, [], :tasklist => options[:tasklist]
117
124
  end
118
125
 
119
126
  desc "listadd NAME", "Adds a new tasklist"
@@ -1,6 +1,6 @@
1
1
  module GoogleTasks
2
2
  APP_NAME = 'goot'
3
- VERSION = '0.0.12'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  GEM_ROOT = File.expand_path('../../..', __FILE__)
6
6
  CONFIG_DIR = File.join(ENV['HOME'], '.goot')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conner McDaniel