honkdo 0.0.0 → 0.0.1
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/honkdo/steps/grep.rb +3 -5
- data/lib/honkdo/steps/print.rb +3 -2
- data/lib/honkdo/steps/sort.rb +4 -2
- metadata +3 -3
data/lib/honkdo/steps/grep.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
step :grep do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
6
|
-
grep.gsub("--\n","")
|
2
|
+
git = File.exists? ".git/"
|
3
|
+
appendix = " -H -n -i TO[D]O ."
|
4
|
+
(git ? `git grep #{appendix}` : `grep -r #{appendix}`).gsub("--\n","")
|
7
5
|
end
|
data/lib/honkdo/steps/print.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
step :print do |todos|
|
2
|
-
|
2
|
+
|
3
3
|
last_tag, last_file = nil
|
4
4
|
todos.each do |t|
|
5
5
|
unless last_tag == t[:tag]
|
6
6
|
last_tag = t[:tag]
|
7
|
+
last_file = nil
|
7
8
|
puts last_tag
|
8
9
|
end
|
9
10
|
unless last_file == t[:file]
|
@@ -12,5 +13,5 @@ step :print do |todos|
|
|
12
13
|
end
|
13
14
|
puts " #{t[:line]}: #{t[:text]}"
|
14
15
|
end
|
15
|
-
end
|
16
16
|
|
17
|
+
end
|
data/lib/honkdo/steps/sort.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
step :sort do |todos|
|
2
2
|
todos.sort do |a,b|
|
3
|
-
(a[:priority] <=> b[:priority]) *
|
4
|
-
(a[:
|
3
|
+
(a[:priority] <=> b[:priority]) * 1000000 +
|
4
|
+
(a[:tag] <=> b[:tag]) * 10000 +
|
5
|
+
(a[:file] <=> b[:file]) * 100 +
|
6
|
+
(a[:line] <=> b[:line])
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
metadata
CHANGED