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.
- data/lib/do_stuff/runner.rb +12 -3
- metadata +1 -1
data/lib/do_stuff/runner.rb
CHANGED
@@ -120,8 +120,17 @@ module DoStuff
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def self.run_editor(file, task_num)
|
123
|
-
|
124
|
-
|
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
|
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
|
|