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.
@@ -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}"
@@ -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
- ed_command! "#{range}c", new_text
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} + 3
141
- placeholders = "%-#{longest_tag_len}s %8s %8s %8s"
142
- headers = %w(tag priority todo done)
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  class TodoRb
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.4'
3
3
  end
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.1
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-01 00:00:00.000000000Z
12
+ date: 2012-02-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &22164760 !ruby/object:Gem::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: *22164760
24
+ version_requirements: *70360584875760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: color-tools
27
- requirement: &22162900 !ruby/object:Gem::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: *22162900
35
+ version_requirements: *70360584874360
36
36
  description: ed-like todo list manager
37
37
  email:
38
38
  - dhchoi@gmail.com