samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

Add --grep option #108

Closed apeschar closed 8 years ago

apeschar commented 9 years ago

This adds a --grep <regexp> (short: -g) option to filter entries when using the t d or t a commands. Only the entries that match the specified regular expression are selected.

samg commented 9 years ago

Looks like a useful feature. Could you add some coverage to the test suite, maybe around https://github.com/samg/timetrap/blob/master/spec/timetrap_spec.rb#L301 and https://github.com/samg/timetrap/blob/master/spec/timetrap_spec.rb#L88?

The failing build looks like an issue with 1.8.7 support in some dependencies and I believe I've resolved it in master.

Thanks!

apeschar commented 9 years ago

I'm having some trouble getting the test suite to work. I'm running cd ../path/to/timetrap && rspec, but a lot of tests are failing with some error that I wasn't able to debug yet:

> ruby -v                                                                 ~/code/timetrap
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13]
> rspec                                                                   ~/code/timetrap
.........................FFFFFFFFFFF...................................F.F.FFFF..........
......................................

Failures:

  1) Timetrap CLI COMMANDS display text should display the current timesheet
     Failure/Error: Timetrap::Timer.process_time(str)
     NoMethodError:
       undefined method `getlocal' for nil:NilClass
     # ./lib/timetrap/timer.rb:26:in `process_time'
     # ./spec/timetrap_spec.rb:7:in `local_time'
     # ./spec/timetrap_spec.rb:320:in `block (6 levels) in <top (required)>'

[...]

Is this anything you've seen before and/or can you give me a pointer?

samg commented 9 years ago

Yeah, it looks like there's a problem with the test suite in Ruby 2.2. I'll look into fixing it. All tests pass in Ruby 2.1.

On Mon, Feb 16, 2015 at 3:25 AM, Albert Peschar notifications@github.com wrote:

I'm having some trouble getting the test suite to work. I'm running cd ../path/to/timetrap && rspec, but a lot of tests are failing with some error that I wasn't able to debug yet:

ruby -v ~/code/timetrap ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13] rspec ~/code/timetrap .........................FFFFFFFFFFF...................................F.F.FFFF.......... ......................................

Failures:

1) Timetrap CLI COMMANDS display text should display the current timesheet Failure/Error: Timetrap::Timer.process_time(str) NoMethodError: undefined method `getlocal' for nil:NilClass

./lib/timetrap/timer.rb:26:in`process_time'

 # ./spec/timetrap_spec.rb:7:in `local_time'
 # ./spec/timetrap_spec.rb:320:in`block (6 levels) in <top (required)>'

[...]

Is this anything you've seen before and/or can you give me a pointer?

— Reply to this email directly or view it on GitHub https://github.com/samg/timetrap/pull/108#issuecomment-74494321.

apeschar commented 9 years ago

I'm not really a ruby native, but eventually I figured out I needed to downgrade to rspec 2.x in order to get the tests to work. I've added some tests now, anyway.

samg commented 9 years ago

Thanks! I think I've resolved the test failures under Ruby 2.2 now as well. I'll take a look asap and see about getting this merged and released.

On Fri, Mar 6, 2015 at 1:47 AM, Albert Peschar notifications@github.com wrote:

I'm not really a ruby native, but eventually I figured out I needed to downgrade to rspec 2.x in order to get the tests to work. I've added some tests now, anyway.

— Reply to this email directly or view it on GitHub https://github.com/samg/timetrap/pull/108#issuecomment-77532607.

tjstankus commented 8 years ago

I pulled this changeset into my fork. Tests pass and it works well, AFAICT. :+1:

jostber commented 8 years ago

Any update on if this feature will be added?

samg commented 8 years ago

Thanks! released in https://rubygems.org/gems/timetrap/versions/1.10.0