pomo 2.0.2 → 2.1.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.
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-head
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - 1.8.7
7
+ - ree
@@ -1,14 +1,36 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ 2.1.0 / 2013-01-17
5
+ ==================
6
+
7
+ * Added `pomo initconfig` to set up global preferences. Preferences
8
+ can be overridden on the command-line (e.g. `pomo start --notifier
9
+ growl`). Closes #30
10
+ * Added multiple args to commands (e.g. `pomo rm 1..3 5..8`). Closes [#12]
11
+ * Added `pomo move` and `pomo copy`. Closes #18
12
+ * Added RSpec specs and Cucumber features. Closes #9
13
+
14
+ View [the full changelog][2.1.0].
15
+ [2.1.0]: https://github.com/visionmedia/pomo/compare/v2.0.2...v2.1.0
16
+
1
17
  2.0.2 / 2012-12-18
2
18
  ==================
3
19
 
4
20
  * Fixed Growl support. Closes #29
5
21
  * Removed unused configuration option `pomo_stat` from `.pomorc`
6
22
 
23
+ View [the full changelog][2.0.2].
24
+ [2.0.2]: https://github.com/visionmedia/pomo/compare/v2.0.1...v2.0.2
25
+
7
26
  2.0.1 / 2012-12-16
8
27
  ==================
9
28
 
10
29
  * Minor fix bug release for tmux status bar coloring.
11
30
 
31
+ View [the full changelog][2.0.1].
32
+ [2.0.1]: https://github.com/visionmedia/pomo/compare/v2.0.0...v2.0.1
33
+
12
34
  2.0.0 / 2012-12-16
13
35
  ==================
14
36
 
@@ -20,6 +42,9 @@
20
42
  * Added support for importing a single Github issue. Closes #2
21
43
  * Added `pomo ls` as an alias to `pomo list`
22
44
 
45
+ View [the full changelog][2.0.0].
46
+ [2.0.0]: https://github.com/visionmedia/pomo/compare/1.0.1...v2.0.0
47
+
23
48
  1.0.1 / 2010-03-10
24
49
  ==================
25
50
 
File without changes
data/README.md CHANGED
@@ -15,22 +15,36 @@ status bar.
15
15
  ## Installation
16
16
 
17
17
  $ gem install pomo
18
-
18
+
19
+ ## Configuration
20
+
21
+ Pomo uses `~/.pomorc` for configuration options.
22
+
23
+ To initialize a default configuration file:
24
+
25
+ $ pomo initconfig
26
+
27
+ See [Configuration Options](#configuration-options) for more details on all the available options.
28
+
19
29
  ## Task Selection API
20
30
 
21
31
  Taken from `pomo help`:
22
32
 
23
- Most of the subcommands work directly with tasks,
24
- and because of this pomo provides a unified task selection api
25
- shown below which can be used with most of the commands
26
- (those with [task ...] in their synopsis).
27
-
33
+ pomo provides a unified task selection api which can be used
34
+ with most of the commands. Commands with [task] or [task ...]
35
+ in their synopsis accept only single or both single and multiple
36
+ task selection, respectively.
37
+
38
+ Single task selection:
28
39
  n : selects a single task by index : Ex: pomo remove 1
29
- [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
30
- n..n : selects a range of tasks : Ex: pomo remove 5..9
31
- n..-n : selects a range of tasks : Ex: pomo remove 2..-1
32
40
  first : selects the first task : Ex: pomo remove first
33
41
  last : selects the last task : Ex: pomo remove last
42
+
43
+ Multiple task selection:
44
+ [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
45
+ [n..n]+ : selects a range of tasks : Ex: pomo remove 5..9 11..14
46
+ [n..-n]+ : selects a range of tasks : Ex: pomo remove 2..-1
47
+ [api ]+ : selects several tasks by api : Ex: pomo remove first last
34
48
  complete : selects complete tasks : Ex: pomo remove complete
35
49
  incomplete : selects incomplete tasks : Ex: pomo remove incomplete
36
50
  all : selects all tasks : Ex: pomo remove all
@@ -67,7 +81,7 @@ Taken from `pomo help`:
67
81
 
68
82
  * Alternatively, you can start the first incomplete task with a progress bar:
69
83
 
70
- $ pomo start -p
84
+ $ pomo start --progress
71
85
  Started Fix IE6 stying issues, you have 25 minutes :)
72
86
  (=........................) 24 minutes remaining
73
87
 
@@ -141,34 +155,35 @@ Taken from `pomo help`:
141
155
  auto-detect `./.pomo` in this directory, and utilize its contents.
142
156
 
143
157
  $ pomo init
144
-
145
- ## Configuration
146
158
 
147
- Pomo uses `~/.pomorc` for configuration options.
159
+ ## Configuration Options
148
160
 
149
- Configuration options:
161
+ The default configuration for pomo is as follows:
150
162
 
151
- * `:notifier`: Notification library
152
- * Format: String
153
- * Default: depends on OS
154
- * Valid values: `notification_center`, `libnotify`, `growl`, `quicksilver`
155
- * `:tmux`: Refresh tmux status bar on timer change
156
- * Format: Boolean
157
- * Default: `false`
158
- * Valid values: `true`, `false`
163
+ * Notification library is set to Notification Center on OSX 10.8; Growl on OSX
164
+ 10.7 or less and Windows; and libnotify on Linux
165
+ * Progress bar is turned off
166
+ * tmux integration is turned off
159
167
 
160
- For example on Mac OS X Mountain Lion, `~/.pomorc` defaults to:
168
+ Settings are easily customizable. Taken from `pomo help initconfig`:
161
169
 
162
- ---
163
- :notifier: notification_center
164
- :tmux: false
170
+ Examples:
165
171
 
166
- ## tmux Status Bar Integration
172
+ # Configure with notification center, no progress bar, and tmux integration
173
+ pomo initconfig --notifier notification_center --no-progress --tmux
167
174
 
168
- The Pomo timer can be displayed in tmux's status bar with the following
169
- configurations set:
175
+ Options:
176
+ --notifier <lib> Specify notificaiton library: `notification_center`, `libnotify`, `growl`, `quicksilver`
177
+ --[no-]progress Run with progress bar
178
+ --[no-]tmux Refresh tmux status bar on timer change
179
+ --[no-]force force overwrite of existing config file
170
180
 
171
- :tmux: true
181
+ ### Tmux Status Bar Integration
182
+
183
+ Pomo's timer can be displayed in tmux's status bar with the following
184
+ configuration set:
185
+
186
+ pomo initconfig --tmux
172
187
 
173
188
  Then add the below to your `~/.tmux.conf`:
174
189
 
@@ -180,3 +195,15 @@ and blue during a break e.g.
180
195
 
181
196
  ![tmux status bar](http://i.imgur.com/uIzM3.png)
182
197
 
198
+ ## Contributing
199
+
200
+ We :heart: pull requests and feedback. Feel free to
201
+ [submit a ticket](https://github.com/visionmedia/pomo/issues) or see
202
+ [CONTRIBUTING](https://github.com/visionmedia/pomo/blob/master/CONTRIBUTING.md)
203
+ for details on pull requests.
204
+
205
+ ## Copyright
206
+
207
+ Copyright (c) 2012 TJ Holowaychuk. See
208
+ [LICENSE](https://github.com/visionmedia/pomo/blob/master/LICENSE.md)
209
+ for details.
data/Rakefile CHANGED
@@ -1,8 +1,15 @@
1
+ require 'cucumber/rake/task'
1
2
  require 'rspec/core/rake_task'
2
3
  require 'bundler/gem_tasks'
4
+ require 'yard'
3
5
 
4
- desc 'Run specs'
5
- RSpec::Core::RakeTask.new do |t|
6
- t.verbose = false
7
- t.rspec_opts = '--color'
8
- end
6
+ task :default => :test
7
+
8
+ Cucumber::Rake::Task.new(:cucumber)
9
+
10
+ RSpec::Core::RakeTask.new(:spec)
11
+
12
+ YARD::Rake::YardocTask.new(:doc)
13
+
14
+ desc 'Run tests, both RSpec and Cucumber'
15
+ task :test => [:spec, :cucumber]
data/bin/pomo CHANGED
@@ -1,43 +1,62 @@
1
1
  #!/usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
- $:.unshift File.dirname(__FILE__) + '/../lib'
5
- require 'rubygems'
6
4
  require 'commander/import'
7
5
  require 'pomo'
8
6
 
9
7
  program :version, Pomo::VERSION
10
8
 
11
9
  program :description, "Pomodoro time management.
12
- Most of the subcommands work directly with tasks, and
13
- because of this pomo provides a unified task selection api
14
- shown below which can be used with most of the commands
15
- (those with [task ...] in their synopsis).
16
10
 
11
+ pomo provides a unified task selection api which can be used
12
+ with most of the commands. Commands with [task] or [task ...]
13
+ in their synopsis accept only single or both single and multiple
14
+ task selection, respectively.
15
+
16
+ Single task selection:
17
17
  n : selects a single task by index : Ex: pomo remove 1
18
- [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
19
- n..n : selects a range of tasks : Ex: pomo remove 5..9
20
- n..-n : selects a range of tasks : Ex: pomo remove 2..-1
21
18
  first : selects the first task : Ex: pomo remove first
22
19
  last : selects the last task : Ex: pomo remove last
20
+
21
+ Multiple task selection:
22
+ [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
23
+ [n..n]+ : selects a range of tasks : Ex: pomo remove 5..9 11..14
24
+ [n..-n]+ : selects a range of tasks : Ex: pomo remove 2..-1
25
+ [api ]+ : selects several tasks by api : Ex: pomo remove first last
23
26
  complete : selects complete tasks : Ex: pomo remove complete
24
27
  incomplete : selects incomplete tasks : Ex: pomo remove incomplete
25
- all : selects all tasks : Ex: pomo remove all
26
- "
28
+ all : selects all tasks : Ex: pomo remove all"
29
+
30
+ program :help_formatter, :compact
27
31
 
28
32
  program :int_message, "\nTerminated pomo" \
29
33
  "\n * previously running tasks not marked as complete" \
30
34
  "\n * manually complete a task with `$ pomo complete <task>`"
31
35
 
32
- config = Pomo::Configuration.new
33
36
  list = Pomo::List.new
34
37
 
35
38
  default_command :list
36
39
 
40
+ command :initconfig do |c|
41
+ c.syntax = 'pomo initconfig [options]'
42
+ c.description = 'Initialize default configuration'
43
+ c.example 'Configure with notification center, no progress bar, and tmux integration', 'pomo initconfig --notifier notification_center --no-progress --tmux'
44
+
45
+ c.option '--notifier <lib>', String, 'Specify notificaiton library: `notification_center`, `libnotify`, `growl`, `quicksilver`'
46
+ c.option '--[no-]progress' , 'Run with progress bar'
47
+ c.option '--[no-]tmux' , 'Refresh tmux status bar on timer change'
48
+ c.option '--[no-]force' , 'force overwrite of existing config file'
49
+ c.action do |args, options|
50
+ Pomo::Configuration.save(options.__hash__)
51
+ end
52
+ end
53
+
37
54
  command :init do |c|
38
- c.syntax = 'pomo init [options]'
55
+ c.syntax = 'pomo init [options]'
39
56
  c.description = 'Initialize pomo in the current directory'
57
+
40
58
  c.action do |args, options|
59
+ config = Pomo::Configuration.load
41
60
  Pomo::List.new :init => true
42
61
  say 'Initialized at `./.pomo`'
43
62
  say ' - Any commands run while in this directory will reference this file for tasks'
@@ -46,20 +65,23 @@ command :init do |c|
46
65
  end
47
66
 
48
67
  command :start do |c|
49
- c.syntax = 'pomo start [task] [options]'
50
- c.summary = 'Start a task'
68
+ c.syntax = 'pomo start [task] [options]'
69
+ c.summary = 'Start a task'
51
70
  c.description = 'Start a task, given the task [task] or the first task'
52
71
  c.example 'Start the first incomplete task', 'pomo start'
53
- c.example 'Start the first task', 'pomo start 0'
54
- c.example 'Start the first task', 'pomo start first'
55
- c.example 'Start the fifth task', 'pomo start 5'
56
- c.option '-p', '--progress', 'Run with progress bar in foreground'
72
+ c.example 'Start the first task' , 'pomo start 0'
73
+ c.example 'Start the first task' , 'pomo start first'
74
+ c.example 'Start the fifth task' , 'pomo start 5'
75
+
76
+ c.option '--notifier <lib>', String, 'Specify notificaiton library: `notification_center`, `libnotify`, `growl`, `quicksilver`'
77
+ c.option '--[no-]progress' , 'Run with progress bar'
78
+ c.option '--[no-]tmux' , 'Refresh tmux status bar on timer change'
57
79
  c.action do |args, options|
58
80
  abort 'a task is already running' if list.running
59
81
 
60
- options.default :progress => false
82
+ config = Pomo::Configuration.load(options.__hash__)
61
83
  args = ['incomplete'] if args.empty?
62
- list.find(*args) do |task, i|
84
+ list.find(*args) do |task|
63
85
  abort 'task already completed' if task.complete?
64
86
  task.start(config, :progress => options.progress, :list => list)
65
87
  break
@@ -68,50 +90,39 @@ command :start do |c|
68
90
  end
69
91
 
70
92
  command :import do |c|
71
- c.syntax = 'pomo import <user> <project> [issue_number]'
72
- c.summary = 'Import Github project issues'
93
+ c.syntax = 'pomo import <user> <project> [issue_number]'
94
+ c.summary = 'Import Github issue(s)'
73
95
  c.description = 'Import Github project issues which have not yet been closed'
74
96
  c.example 'Import all open Github issues from "visionmedia/pomo"', 'pomo import visionmedia pomo'
75
- c.example 'Import Github issue #3 from "visionmedia/pomo"', 'pomo import visionmedia pomo 3'
97
+ c.example 'Import Github issue #3 from "visionmedia/pomo"' , 'pomo import visionmedia pomo 3'
98
+
76
99
  c.action do |args, options|
100
+ config = Pomo::Configuration.load
77
101
  user = args.shift or raise('Github <user> is required')
78
102
  project = args.shift or raise('Github <project> is required')
79
103
  number = args.shift
80
- begin
81
- if number
82
- issues = [Octokit.issue({:username => user, :repo => project}, number)]
83
- else
84
- issues = Octokit.list_issues({:username => user, :repo => project}, :state => 'open', :sort => 'created')
85
- end
86
- issues.each_with_index do |issue, index|
87
- say "Importing issues from https://github.com/#{user}/#{project}" if index == 0
88
- task = Pomo::GithubTask.new(issue.title,
89
- :username => user,
90
- :project => project,
91
- :description => issue.body,
92
- :labels => issue.labels.map(&:name),
93
- :number => issue.number
94
- )
95
- list << task
96
- say " - Added #{task}"
97
- end
98
- list.save
99
- rescue Octokit::NotFound => e
100
- say '404: This is not the repo you are looking for.'
101
- say e.message
104
+
105
+ say "Importing issues from https://github.com/#{user}/#{project}"
106
+ tasks = Pomo::GithubTask.import(user, project, number)
107
+ tasks.each do |task|
108
+ list << task
109
+ say " - Added #{task}"
102
110
  end
111
+ list.save
103
112
  end
104
113
  end
105
114
 
106
115
  command :add do |c|
107
- c.syntax = 'pomo add <task> [options]'
108
- c.summary = 'Add a task'
116
+ c.syntax = 'pomo add <task> [options]'
117
+ c.summary = 'Add a task'
109
118
  c.description = 'Add a task to the current list of tasks'
110
119
  c.example 'Adds the task "fix IE styling issues"', 'pomo add "fix IE styling issues"'
111
- c.example 'Add a task with 60 minute limit', 'pomo add "create executable" --length 60'
120
+ c.example 'Add a task with 60 minute limit' , 'pomo add "create executable" --length 60'
121
+
112
122
  c.option '-d', '--description string', 'Add verbose task description'
113
123
  c.option '-l', '--length minutes', Integer, 'Change the default length in minutes'
114
124
  c.action do |args, options|
125
+ config = Pomo::Configuration.load
115
126
  task = Pomo::Task.new(args.shift, options.__hash__)
116
127
  list << task
117
128
  list.save
@@ -120,17 +131,19 @@ command :add do |c|
120
131
  end
121
132
 
122
133
  command :edit do |c|
123
- c.syntax = 'pomo edit [task ...] [options]'
124
- c.summary = 'Edit tasks'
134
+ c.syntax = 'pomo edit [task ...] [options]'
135
+ c.summary = 'Edit task(s)'
125
136
  c.description = 'Edit the given task(s) or the first task'
126
- c.example 'Changes the description for the first task', 'pomo edit first -d "fix IE styling issues"'
137
+ c.example 'Changes the description for the first task' , 'pomo edit first -d "fix IE styling issues"'
127
138
  c.example 'Changes the description and length for the third task', 'pomo edit 3 -d "fix IE styling issues" -l 60'
128
- c.example 'Changes the length of several tasks', 'pomo edit 1..5 -l 10'
139
+ c.example 'Changes the length of several tasks' , 'pomo edit 1..5 -l 10'
140
+
129
141
  c.option '-n', '--name string', 'Change the task name'
130
142
  c.option '-d', '--description string', 'Change the task description'
131
143
  c.option '-l', '--length minutes', Integer, 'Change the task length'
132
144
  c.action do |args, options|
133
- list.find(*args) do |task, i|
145
+ config = Pomo::Configuration.load
146
+ list.find(*args) do |task|
134
147
  options.__hash__.each do |key, value|
135
148
  task.send :"#{key}=", value
136
149
  end
@@ -141,77 +154,127 @@ command :edit do |c|
141
154
  end
142
155
 
143
156
  command :break do |c|
144
- c.syntax = 'pomo break [length] [options]'
145
- c.summary = 'Take a break'
157
+ c.syntax = 'pomo break [length] [options]'
158
+ c.summary = 'Start a break'
146
159
  c.description = 'Take a break, defaults to 5 minutes or [length] or --length'
147
160
  c.example 'Take a five minute break', 'pomo break'
148
- c.example 'Take a 30 minute break', 'pomo break 30'
149
- c.example 'Take a 30 minute break', 'pomo break --length 30'
161
+ c.example 'Take a 30 minute break' , 'pomo break 30'
162
+ c.example 'Take a 30 minute break' , 'pomo break --length 30'
163
+
150
164
  c.option '-l', '--length minutes', Integer, 'Change the default length in minutes'
151
- c.option '-p', '--progress', 'Run with progress bar in foreground'
165
+ c.option '--notifier <lib>', String, 'Specify notificaiton library: `notification_center`, `libnotify`, `growl`, `quicksilver`'
166
+ c.option '--[no-]progress' , 'Run with progress bar'
167
+ c.option '--[no-]tmux' , 'Refresh tmux status bar on timer change'
152
168
  c.action do |args, options|
153
- options.default :progress => false
154
169
  options.default :length => args.first ? args.first.to_i : 5
170
+
171
+ config = Pomo::Configuration.load(options.__hash__)
155
172
  task = Pomo::Break.new('Break time', options.__hash__)
156
173
  task.start(config, :progress => options.progress)
157
174
  end
158
175
  end
159
176
 
160
177
  command :remove do |c|
161
- c.syntax = 'pomo [remove|rm] [task ...] [options]'
162
- c.summary = 'Remove tasks'
178
+ c.syntax = 'pomo [remove|rm] [task ...] [options]'
179
+ c.summary = 'Remove task(s)'
163
180
  c.description = 'Remove task(s) or the first task'
164
- c.example 'Remove the first task', 'pomo remove first'
165
- c.example 'Remove the last task', 'pomo remove last'
166
- c.example 'Remove the fifth task', 'pomo remove 5'
181
+ c.example 'Remove the first task' , 'pomo remove first'
182
+ c.example 'Remove the fifth task' , 'pomo rm 5'
167
183
  c.example 'Remove the fifth and second task', 'pomo rm 5 2'
168
- c.example 'Remove a range of tasks', 'pomo rm 2..6'
169
- c.example 'Remove all but the first task', 'pomo rm 2..-1'
170
- c.example 'Remove all tasks', 'pomo rm all'
184
+ c.example 'Remove a range of tasks' , 'pomo rm 2..6'
185
+ c.example 'Remove all but the first task' , 'pomo rm 2..-1'
186
+ c.example 'Remove all tasks' , 'pomo rm all'
187
+
171
188
  c.action do |args, options|
172
- list.find(*args) do |task, i|
189
+ config = Pomo::Configuration.load
190
+ list.find(*args) do |task|
173
191
  list.tasks -= [task]
174
192
  say " - Removed #{task}"
175
193
  end
176
- list.save
194
+ list.save
177
195
  end
178
196
  end
179
197
  alias_command :rm, :remove
180
198
  alias_command :clear, :remove, 'all'
181
199
 
182
- command :view do |c|
183
- c.syntax = 'pomo view [task ...] [options]'
184
- c.summary = 'View verbose task information'
185
- c.description = 'View verbose information for the given task(s) or the first task'
186
- c.example 'View the first task', 'pomo view first'
187
- c.example 'View the last task', 'pomo view last'
188
- c.example 'View the fifth task', 'pomo view 5'
200
+ command :copy do |c|
201
+ c.syntax = 'pomo [copy|cp] [task...]'
202
+ c.summary = 'Copy task(s)'
203
+ c.description = 'Copy task(s) to the end of the current list as an incomplete task'
204
+ c.example 'Copy first task' , 'pomo copy first'
205
+ c.example 'Copy the fourth task' , 'pomo cp 4'
206
+ c.example 'Copy the fifth and second task', 'pomo cp 5 2'
207
+ c.example 'Copy a range of tasks' , 'pomo cp 2..6'
208
+ c.example 'Copy all but the first task' , 'pomo cp 2..-1'
209
+ c.example 'Copy all tasks' , 'pomo cp all'
210
+
211
+ c.action do |args, options|
212
+ config = Pomo::Configuration.load
213
+ list.find(*args) do |task|
214
+ dup_task = Marshal::load(Marshal.dump(task))
215
+ dup_task.complete = false
216
+ list.tasks << dup_task
217
+ say " - Copied #{task}"
218
+ end
219
+ list.save
220
+ end
221
+ end
222
+ alias_command :cp, :copy
223
+
224
+ command :move do |c|
225
+ c.syntax = 'pomo move [from] [to]'
226
+ c.summary = 'Move a task'
227
+ c.description = 'Move a task to a different position in the current list'
228
+ c.example 'Move task 4 to position 2' , 'pomo move 4 2'
229
+ c.example 'Move last task to first position', 'pomo mv last first'
230
+
231
+ c.action do |args, options|
232
+ config = Pomo::Configuration.load
233
+ from = args.shift or raise('<from> is required')
234
+ to = args.shift or raise('<to> is required')
235
+ list.find(from) do |task|
236
+ list.find(to) do |other_task|
237
+ list.move(from, to)
238
+ say " - Moved #{task} from position #{from} to #{to}"
239
+ end
240
+ end
241
+ list.save
242
+ end
243
+ end
244
+ alias_command :mv, :move
245
+
246
+ # TODO remove view alias in 3.0 release
247
+ command :show do |c|
248
+ c.syntax = 'pomo show [task ...] [options]'
249
+ c.summary = 'Show verbose task information'
250
+ c.description = 'Show verbose information for the given task(s) or the first task'
251
+ c.example 'Show the first task', 'pomo show first'
252
+ c.example 'Show the last task' , 'pomo show last'
253
+ c.example 'Show the fifth task', 'pomo show 5'
254
+
189
255
  c.action do |args, options|
190
- list.find(*args) do |task, i|
256
+ config = Pomo::Configuration.load
257
+ list.find(*args) do |task|
191
258
  say "\n"
192
259
  format = "%15s : %s\n"
193
- say format % ['name', task.name]
194
- say format % ['length', "#{task.length} minutes"]
195
- say format % ['description', task.description] if task.description and not task.description.empty?
196
- if task.github?
197
- say format % ['labels', task.labels.join(', ')] if task.labels and not task.labels.empty?
198
- say format % ['number', task.number ]
199
- say format % ['uri', task.uri ]
200
- end
260
+ task.verbose_output(format)
201
261
  end
202
262
  say "\n"
203
263
  end
204
264
  end
265
+ alias_command :view, :show
205
266
 
206
267
  command :complete do |c|
207
- c.syntax = 'pomo complete [task ...] [options]'
208
- c.summary = 'Mark tasks as completed'
268
+ c.syntax = 'pomo complete [task ...] [options]'
269
+ c.summary = 'Mark task(s) as completed'
209
270
  c.description = 'Mark the given task(s) or the first task to complete'
210
271
  c.example 'Mark first task as complete', 'pomo complete first'
211
- c.example 'Mark last task as complete', 'pomo complete last'
272
+ c.example 'Mark last task as complete' , 'pomo complete last'
212
273
  c.example 'Mark fifth task as complete', 'pomo complete 5'
274
+
213
275
  c.action do |args, options|
214
- list.find(*args) do |task, i|
276
+ config = Pomo::Configuration.load
277
+ list.find(*args) do |task|
215
278
  task.complete = true
216
279
  say " - Completed #{task}"
217
280
  end
@@ -220,14 +283,16 @@ command :complete do |c|
220
283
  end
221
284
 
222
285
  command :incomplete do |c|
223
- c.syntax = 'pomo incomplete [task ...] [options]'
224
- c.summary = 'Mark tasks as incompleted'
286
+ c.syntax = 'pomo incomplete [task ...] [options]'
287
+ c.summary = 'Mark task(s) as incompleted'
225
288
  c.description = 'Mark the given task(s) or the first task as not completed'
226
289
  c.example 'Mark first task as not completed', 'pomo incomplete first'
227
- c.example 'Mark last task as not completed', 'pomo incomplete last'
290
+ c.example 'Mark last task as not completed' , 'pomo incomplete last'
228
291
  c.example 'Mark fifth task as not completed', 'pomo incomplete 5'
292
+
229
293
  c.action do |args, options|
230
- list.find(*args) do |task, i|
294
+ config = Pomo::Configuration.load
295
+ list.find(*args) do |task|
231
296
  task.complete = false
232
297
  say " - #{task} marked incomplete"
233
298
  end
@@ -236,20 +301,24 @@ command :incomplete do |c|
236
301
  end
237
302
 
238
303
  command :list do |c|
239
- c.syntax = 'pomo [list|ls] [options]'
304
+ c.syntax = 'pomo [list|ls] [options]'
240
305
  c.description = 'List all tasks'
241
306
  c.example 'List all tasks', 'pomo list'
307
+
242
308
  c.option '-c', '--complete', 'List only completed tasks'
243
309
  c.option '-i', '--incomplete', 'List only incompleted tasks'
244
310
  c.action do |args, options|
311
+ abort "invalid command. See 'pomo help' for more information" unless args.empty?
312
+
313
+ config = Pomo::Configuration.load
245
314
  total = 0
246
315
  list.tasks.each_with_index do |task, i|
247
316
  next if options.complete && !task.complete?
248
317
  next if options.incomplete && task.complete?
249
- say ' %s %2d. %-45s : %d minutes' % [task.complete? ? '✓' : ' ', i, task.to_s, task.length]
318
+ say ' %s %2d. %-50s : %d minutes' % [task.complete? ? '✓' : ' ', i, task.to_s, task.length]
250
319
  total += task.length
251
320
  end
252
- say ' ' * 55 + '%d minutes' % total
321
+ say ' ' * 60 + '%d minutes' % total
253
322
  end
254
323
  end
255
324
  alias_command :ls, :list