samg / timetrap

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

Allow resuming specific task, which is not the last one #58

Open vlcinsky opened 11 years ago

vlcinsky commented 11 years ago

Motivation

We all know the scenario:

  1. working on something large - being focused.
  2. getting urgent request, interrupt the previous task, make the quick fix
  3. resume the previous large task

With TimeTrap - if the urgent request gets logged into another sheet, all is fine, you reset to previous sheet using "-" and resume the last tasks.

But often one has to do that in the same sheet - and currently one has to retype the previous task description.

Proposal: allow reference to relative task in the same sheet

use -2, -3 etc.

To resume not the last task, but the one before:

$ t resume -2

Even smarter solution would count only unique task names, so even if you had to stop and resume the urgent task few times, -2 would jump over all the urgent entries, back to the large one before.

Hint: What about omitting the - sign?

Allow interactive reference after plain -

After $ t resume - program would print positions of last tasks (from current sheet): 1: last task 2: preceding task 3: pre-preceding tasks

(3 to 5 last entries shall be enough, but could be configurable).

Then user could enter number (without -) and get it resumed.

Pressing enter would by default assume 2, the preceding task.

Allow resuming task by --id

Using existing option --id we could refer to specific task to resume. We would then resume given task (incl. related sheet).

Workflow would be:

  1. $ t in large task
  2. $ t in urgent task
  3. continue resolving any tasks in any sheet
  4. $ t di -v to show list of tasks with id values. Find id for the one to continue, e.g. 77.
  5. $ t resume --id 77

Off topic note: Today, timetrap use paid back to me. My client told me, I am probably overestimating time spent on work for him. Showing timetrap logs stopped that discussion quickly.

samg commented 11 years ago

Jan - It seems like a good idea to provide some facility for the workflow you're describing. It sounds like doing this interactively (maybe with an -i flag) would be the best option. I'm not sure if/when I'll have a chance to implement this feature, but I'll try to get around to it at some point. I'd also be happy to look at a pull request if you or someone else wanted to take a crack at it.

Also glad to hear that timetrap is coming in handy talking with your client. I initially wrote it when I was contracting and needed a simple way to track my time and import it into various systems.

vlcinsky commented 11 years ago

Hi Sam. I am Python guy and Ruby is not what I am proficient in. The best thing I am able to now is to write carefully proposals for new features :-). Anyway, if I find some resources for these modification, I would use them.

vlcinsky commented 11 years ago

For Linux users I found a trick, which can provide most of what I have asked for:

add following two lines to your /etc/inputrc or ~/.inputrc:

"\e[A":history-search-backward
"\e[B":history-search-forward

Then type t in and then use and to swap through last t in calls.

Works for other commands too.

Found at StackOverflow

The same trick may help with t s for switching over bigger number of sheets with more complicated names too.

jostber commented 11 years ago

That's a brilliant one, thanks!

samg commented 11 years ago

nice