todo.rb 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/todo.rb +4 -1
- data/lib/todo.rb.rb +10 -5
- data/lib/todo.rb/help.rb +2 -0
- data/lib/todo.rb/version.rb +1 -1
- metadata +6 -6
data/bin/todo.rb
CHANGED
@@ -23,10 +23,13 @@ t = TodoRb.new opts
|
|
23
23
|
args = ARGV.dup
|
24
24
|
|
25
25
|
if args.size <= 2 && args.delete('!')
|
26
|
-
# This is kind of a hack!
|
27
26
|
exec "#{File.expand_path(__FILE__)} #{args.join(' ')} | grep '!'"
|
28
27
|
end
|
29
28
|
|
29
|
+
if args.size == 1 && args.delete('l')
|
30
|
+
exec "#{File.expand_path(__FILE__)} #{args.join(' ')} | less -R"
|
31
|
+
end
|
32
|
+
|
30
33
|
if args[0] =~ /^-\d+$/
|
31
34
|
range = args.shift
|
32
35
|
exec "#{File.expand_path(__FILE__)} #{args.join(' ')} | head #{range}"
|
data/lib/todo.rb.rb
CHANGED
@@ -121,7 +121,12 @@ END
|
|
121
121
|
`sed -n '#{range}p' #{todo_file} > #{f.path}`
|
122
122
|
system("#{ENV['EDITOR']} #{f.path}")
|
123
123
|
new_text = File.read(f.path).strip
|
124
|
-
|
124
|
+
range.inspect
|
125
|
+
if range != ""
|
126
|
+
ed_command! "#{range}c", new_text
|
127
|
+
else
|
128
|
+
`cp #{f.path} #{todo_file}`
|
129
|
+
end
|
125
130
|
end
|
126
131
|
|
127
132
|
TAG_REGEX = /[@\+]\S+/
|
@@ -137,14 +142,14 @@ END
|
|
137
142
|
end
|
138
143
|
}; report_data
|
139
144
|
}
|
140
|
-
longest_tag_len = report_data.keys.reduce(0) {|max, key| [max, key.length].max} +
|
141
|
-
placeholders = "
|
142
|
-
headers = %w(tag
|
145
|
+
longest_tag_len = report_data.keys.reduce(0) {|max, key| [max, key.length].max} + 1
|
146
|
+
placeholders = "%#{longest_tag_len}s %5s %5s %5s"
|
147
|
+
headers = %w(tag pri todo done)
|
143
148
|
IO.popen(formatter, 'w') {|pipe|
|
144
149
|
pipe.puts(placeholders % headers)
|
145
150
|
pipe.puts placeholders.scan(/\d+/).map {|a|'-'*(a.to_i)}.join(' ')
|
146
151
|
report_data.keys.sort_by {|k| k.downcase}.each {|k|
|
147
|
-
pipe.puts placeholders % [k, report_data[k][:priority], report_data[k][:todo], report_data[k][:done]]
|
152
|
+
pipe.puts placeholders % [k, report_data[k][:priority], report_data[k][:todo], report_data[k][:done]].map {|x| x == 0 ? ' ' : x}
|
148
153
|
}
|
149
154
|
}
|
150
155
|
end
|
data/lib/todo.rb/help.rb
CHANGED
@@ -21,6 +21,8 @@ t [tag] [task text] append a task with tag
|
|
21
21
|
t show tasks
|
22
22
|
t [ed command] perform ed command on todo list
|
23
23
|
t e [task address] edit task at [task address] in external EDITOR
|
24
|
+
t e edit entire task list in external EDITOR
|
25
|
+
t l pipe entire list to `less -R`
|
24
26
|
t done show done tasks
|
25
27
|
t do [task address] move a task to the done.txt
|
26
28
|
t undo [task address] move a task from done.txt to todo.txt
|
data/lib/todo.rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todo.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|
16
|
-
requirement: &
|
16
|
+
requirement: &70360584875760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.6.11
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70360584875760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: color-tools
|
27
|
-
requirement: &
|
27
|
+
requirement: &70360584874360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70360584874360
|
36
36
|
description: ed-like todo list manager
|
37
37
|
email:
|
38
38
|
- dhchoi@gmail.com
|