do_stuff 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. data/lib/do_stuff/runner.rb +12 -3
  2. metadata +1 -1
@@ -120,8 +120,17 @@ module DoStuff
120
120
  end
121
121
 
122
122
  def self.run_editor(file, task_num)
123
- # TODO: Use task_num to jump to a line
124
- system(ENV['EDITOR'], file)
123
+ target_line = nil
124
+
125
+ File.readlines(file).each_with_index do |line, line_num|
126
+ target_line = line_num + 1 if line.start_with?("#{task_num}. ")
127
+ end
128
+
129
+ if target_line
130
+ system(ENV['EDITOR'], file, "+#{target_line}")
131
+ else
132
+ system(ENV['EDITOR'], file)
133
+ end
125
134
  end
126
135
 
127
136
  def self.usage
@@ -131,7 +140,7 @@ module DoStuff
131
140
  usage: #{program} list unfinished tasks
132
141
  #{program} <task desc> add a new task
133
142
  #{program} <task num> erase task
134
- #{program} -e [task num edit task file and jump to given task
143
+ #{program} -e [task num] edit task file and jump to given task
135
144
  #{program} -h, --help show this message
136
145
  EOS
137
146
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_stuff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: