Giter Club home page Giter Club logo

timetrap's Introduction

Timetrap Build Status

Timetrap is a simple command line time tracker written in ruby. It provides an easy to use command line interface for tracking what you spend your time on.

Getting Started

To install:

$ gem install timetrap

This will place a t executable in your path.

If you have errors while parsing the documentation, use --no-document option when installing the gem, or other option is to gem install rdoc before installing the timetrap. This is a known issue from rdoc

Basic Usage

$ # get help
$ timetrap --help
$ # or
$ t --help

Timetrap maintains a list of timesheets.

$ # create the "coding" timesheet
$ t sheet coding
Switching to sheet coding

All commands can be abbreviated.

$ # same as "t sheet coding"
$ t s coding
Switching to sheet coding

Each timesheet contains entries. Each entry has a start and end time, and a note associated with it. An entry without an end time set is considered to be running.

You check in to the current sheet with the in command.

$ # check in with "document timetrap" note
$ t in document timetrap
Checked into sheet "coding".

Commands like display and now will show you the running entry.

$ t display
Timesheet: coding
    Day                Start      End        Duration   Notes
    Sun Nov 28, 2010   12:26:10 -            0:00:03    document timetrap
                                             0:00:03
    ---------------------------------------------------------
    Total                                    0:00:03

$ t now
*coding: 0:01:02 (document timetrap)

If you make a mistake use the edit command.

$ # edit the running entry's note
$ t edit writing readme
Editing running entry

You check out with the out command.

$ t out
Checked out of entry "document timetrap" in sheet "coding"

Running edit when you're checked out will edit the last entry you checked out of.

$ t edit --append "oh and that"
Editing last entry you checked out of

You can edit entries that aren't running using edit's --id or -i flag. t display --ids (or t display -v) will tell you the ids.

$ # note id column in output
$ t d -v
Timesheet: coding
Id  Day                Start      End        Duration   Notes
43  Sun Nov 28, 2010   12:26:10 - 13:41:03   1:14:53    writing readme
                                             1:14:53
    ---------------------------------------------------------
    Total                                    1:14:53

$ # -i43 to edit entry 43
$ t e -i43 --end "2010-11-28 13:45"
Editing entry with id 43

$ t d
Timesheet: coding
    Day                Start      End        Duration   Notes
    Sun Nov 28, 2010   12:26:10 - 13:45:00   1:18:50    writing readme
                                             1:18:50
    ---------------------------------------------------------
    Total                                    1:18:50

Natural Language Times

Commands such as in, out, edit, and display have flags that accept times as arguments. Any time you pass Timetrap a time it will try to parse it as a natural language time.

This is very handy if you start working and forget to start Timetrap. You can check in 5 minutes ago using in's --at flag.

$ t in --at "5 minutes ago"

Command line flags also have short versions.

$ # equivalent to the command above
$ t i -a "5 minutes ago"

You can consult the Chronic gem (https://github.com/mojombo/chronic) for a full list of parsable time formats, but all of these should work.

$ t out --at "in 30 minutes"
$ t edit --start "last monday at 10:30am"
$ t edit --end "tomorrow at noon"
$ t display --start "10am" --end "2pm"
$ t i -a "2010-11-29 12:30:00"

Output Formats

Built-in Formatters

Timetrap has built-in support for 6 output formats.

These are text, csv, ical, json, and ids

The default is a plain text format. (You can change the default format using t configure).

$ t display
Timesheet: coding
    Day                Start      End        Duration   Notes
    Mon Apr 13, 2009   15:46:51 - 17:03:50   1:16:59    improved display functionality
                       17:25:59 - 17:26:02   0:00:03
                       18:38:07 - 18:38:52   0:00:45    working on list
                       22:37:38 - 23:38:43   1:01:05    work on kill
                                             2:18:52
    Tue Apr 14, 2009   00:41:16 - 01:40:19   0:59:03    gem packaging
                       10:20:00 - 10:48:10   0:28:10    working on readme
                                             1:27:13
    ---------------------------------------------------------
    Total                                    3:46:05

The CSV formatters is easy to import into a spreadsheet.

$ t display --format csv
start,end,note,sheet
"2010-08-21 11:19:05","2010-08-21 12:12:04","migrated site","coding"
"2010-08-21 12:44:09","2010-08-21 12:48:46","DNS emails and install email packages","coding"
"2010-08-21 12:49:57","2010-08-21 13:10:12","A records","coding"
"2010-08-21 15:09:37","2010-08-21 16:32:26","setup for wiki","coding"
"2010-08-25 20:42:55","2010-08-25 21:41:49","rewrote index","coding"
"2010-08-29 15:44:39","2010-08-29 16:21:53","recaptcha","coding"
"2010-08-29 21:15:58","2010-08-29 21:30:31","backups","coding"
"2010-08-29 21:40:56","2010-08-29 22:32:26","backups","coding"

iCal format lets you get your time into your favorite calendar program (remember commands can be abbreviated).

$ t d -f ical > MyTimeSheet.ics

The ids formatter is provided to facilitate scripting within timetrap. It only outputs numeric id for the entries. This is handy if you want to move all entries from one sheet to another sheet. You could do something like this:

$ for id in `t display sheet1 -f ids`; do t edit --id $id --move sheet2; done
editing entry #36
editing entry #37
editing entry #44
editing entry #46

A json formatter is provided because hackers love json.

$ t d -fjson

Custom Formatters

Timetrap tries to make it easy to define custom output formats.

You're encouraged to submit these back to timetrap for inclusion in a future version.

To create a custom formatter you create a ruby class and implement two methods on it.

As an example we'll create a formatter that only outputs the notes from entries.

To ensure that timetrap can find your formatter put it in ~/.timetrap/formatters/notes.rb. The filename should be the same as the string you will pass to t d --format to invoke it. If you want to put your formatter in a different place you can run t configure and edit the formatter_search_paths option.

All timetrap formatters live under the namespace Timetrap::Formatters so define your class like this:

class Timetrap::Formatters::Notes
end

When t display is invoked, timetrap initializes a new instance of the formatter passing it an Array of entries. It then calls #output which should return a string to be printed to the screen.

This means we need to implement an #initialize method and an #output method for the class. Something like this:

class Timetrap::Formatters::Notes
  def initialize(entries)
    @entries = entries
  end

  def output
    @entries.map{|entry| entry[:note]}.join("\n")
  end
end

Now when I invoke it:

$ t d -f notes
working on issue #123
working on issue #234

Timetrap Formatters Repository

A community focused repository of custom formatters is available at https://github.com/samg/timetrap_formatters.

Harvest Integration

For timetrap users who use Harvest to manage timesheets, Devon Blandin created timetrap-harvest, a custom formatter which allows you to easily submit your timetrap entries to Harvest timesheets.

See its README for more details.

Toggl Integration

For timetrap users who use Toggl to manage timesheets, Miguel Palhas created timetrap-toggl (a fork of the timetrap-harvest integration mentioned above.

Like the Harvest integration, this one allows you to easily submit your timetrap entries to Toggl.

See its README for more details.

AutoSheets

Timetrap has a feature called auto sheets that allows you to automatically select which timesheet to check into.

Timetrap ships with a couple auto sheets. The default auto sheet is called dotfiles and will read the sheetname to check into from a .timetrap-sheet file in the current directory.

Here are all the included auto sheets

You can specify which auto sheet logic you want to use in ~/.timetrap.yml by changing the auto_sheet value.

Custom AutoSheets

It's also easy to write your own auto sheet logic that matches your personal workflow. You're encouraged to submit these back to timetrap for inclusion in a future version.

To create a custom auto sheet module you create a ruby class and implement one method on it #sheet. This method should return the name of the sheet timetrap should use (as a string) or nil if a sheet shouldn't be automatically selected.

All timetrap auto sheets live under the namespace Timetrap::AutoSheets

To ensure that timetrap can find your auto sheet put it in ~/.timetrap/auto_sheets/. The filename should be the same as the string you will set in the configuration (for example ~/.timetrap/auto_sheets/dotfiles.rb. If you want to put your auto sheet in a different place you can run t configure and edit the auto_sheet_search_paths option.

As an example here's the dotfiles auto sheet

module Timetrap
  module AutoSheets
    class Dotfiles
      def sheet
        dotfile = File.join(Dir.pwd, '.timetrap-sheet')
        File.read(dotfile).chomp if File.exist?(dotfile)
      end
    end
  end
end

Commands

archive Archive the selected entries (by moving them to a sheet called _[SHEET]) These entries can be seen by running t display _[SHEET].

usage: t archive [--start DATE] [--end DATE] [--grep REGEX] [SHEET]

backend Run an interactive database session on the timetrap database. Requires the sqlite3 command.

usage: t backend

configure Create a config file at ~/.timetrap.yml or ENV['TIMETRAP_CONFIG_FILE'] if one doesn't exist. If one does exist, update it with new configuration options preserving any user overrides. Prints path to config file. This file may contain ERB.

usage: t configure

display Display a given timesheet. If no timesheet is specified, show the current timesheet. If all is passed as SHEET display all timesheets. If full is passed as SHEET archived timesheets are displayed as well. Accepts an optional --ids flag which will include the entries' ids in the output. This is useful when editing an non running entry with edit.

Display is designed to support a variety of export formats that can be specified by passing the --format flag. This currently defaults to text. iCal, csv, json, and numeric id output are also supported.

Display also allows the use of a --round or -r flag which will round all times in the output. See global options below.

usage: t display [--ids] [--round] [--start DATE] [--end DATE] [--format FMT] [--grep REGEX] [SHEET | all | full]

edit Insert a note associated with the an entry in the timesheet, or edit the start or end times. Defaults to the current entry, or previously running entry. An --id flag can be passed with the entry's id (see display.)

usage: t edit [--id ID] [--start TIME] [--end TIME] [--append] [NOTES]

in Start the timer for the current timesheet. Must be called before out. Notes may be specified for this period. This is exactly equivalent to t in; t edit NOTES. Accepts an optional --at flag.

usage: t in [--at TIME] [NOTES]

kill Delete a timesheet or an entry. Entries are referenced using an --id flag (see display). Sheets are referenced by name.

usage: t kill [--id ID] [TIMESHEET]

list List the available timesheets.

usage: t list

now Print a description of all running entries.

usage: t now

out Stop the timer for the current timesheet. Must be called after in. Accepts an optional --at flag. Accepts an optional TIMESHEET name to check out of a running, non-current sheet. Will check out of all running sheets if the auto_checkout configuration option is enabled.

usage: t out [--at TIME] [TIMESHEET]

resume Start the timer for the current time sheet for an entry. Defaults to the active entry.

usage: t resume [--id ID] [--at TIME]

sheet Switch to a timesheet creating it if necessary. The default timesheet is called "default". When no sheet is specified list all existing sheets. The special timesheet name '-' will switch to the last active sheet.

usage: t sheet [TIMESHEET]

today Shortcut for display with start date as the current day

usage: t today [--ids] [--format FMT] [SHEET | all]

yesterday Shortcut for display with start and end dates as the day before the current day

usage: t yesterday [--ids] [--format FMT] [SHEET | all]

week Shortcut for display with start date set to a day of this week. The default start of the week is Monday.

usage: t week [--ids] [--end DATE] [--format FMT] [TIMESHEET | all]

month Shortcut for display with start date set to the beginning of this month (or a specified month) and end date set to the end of the month.

usage: t month [--ids] [--start MONTH] [--format FMT] [TIMESHEET | all]

Global Options

rounding passing a --round or -r flag to any command will round entry start and end times to the closest 15 minute increment. This flag only affects the display commands (e.g. display, list, week, etc.) and is non-destructive. The actual start and end time stored by Timetrap are unaffected.

See configure command to change rounding increment from 15 minutes.

non-interactive passing a --yes or -y flag will cause any command that requires confirmation (such as kill) to assume an affirmative response to any prompt. This is useful when timetrap is used in a scripted environment.

Configuration

Configuration of Timetrap's behavior can be done through an ERB interpolated YAML config file.

See t configure for details. Currently supported options are:

round_in_seconds: The duration of time to use for rounding with the -r flag

database_file: The file path of the sqlite database

append_notes_delimiter: delimiter used when appending notes via t edit --append

formatter_search_paths: an array of directories to search for user defined fomatter classes

default_formatter: The format to use when display is invoked without a --format option

default_command: The default command to invoke when you call t

auto_checkout: Automatically check out of running entries when you check in or out

require_note: Prompt for a note if one isn't provided when checking in

auto_sheet: Which auto sheet module to use.

auto_sheet_search_paths: an array of directories to search for user defined auto_sheet classes

note_editor: The command to start editing notes. Defaults to false which means no external editor is used. Please see the section below on Notes Editing for tips on using non-terminal based editors. Example: note_editor: "vim"

week_start: The day of the week to use as the start of the week for t week.

Autocomplete

Timetrap has some basic support for autocomplete in bash and zsh. There are completions for commands and for sheets.

HINT If you don't know where timetrap is installed, have a look in the directories listed in echo $GEM_PATH.

bash

If it isn't already, add the following to your .bashrc/.bash_profile:

if [ -f /etc/bash_completion ]; then
  . /etc/bash_completion
fi

Then add this to source the completions:

source /path/to/timetrap-1.x.y/gem/completions/bash/timetrap-autocomplete.bash

zsh

If it isn't already, add the following to your .zshrc:

autoload -U compinit
compinit

Then add this to source the completions:

fpath=(/path/to/timetrap-1.x.y/gem/completions/zsh $fpath)

Notes editing

If you use the note_editor setting, then it is possible to use an editor for writing your notes. If you use a non terminal based editor (like atom, sublime etc.) then you will need to make timetrap wait until the editor has finished. If you're using the "core.editor" flag in git, then it'll be the same flags you'll use.

As of when this command was added, for atom you would use atom --wait and for sublime subl -w. If you use a console based editor (vim, emacs, nano) then it should just work.

Development

Get bundler in case you don't have it:

gem install bundler

Set a local path for the project's dependencies:

bundle config set --local path 'vendor/bundle'

Install timetrap's dependencies:

bundle install

Now you can run your local timetrap installation:

bundle exec t

Or run the test suite:

bundle exec rspec

Special Thanks

The initial version of Timetrap was heavily inspired by Trevor Caira's Timebook, a small python utility.

Original Timebook available at: http://bitbucket.org/trevor/timebook/src/

Bugs and Feature Requests

Submit to http://github.com/samg/timetrap/issues

timetrap's People

Contributors

apeschar avatar berkes avatar categulario avatar dashkb avatar dblandin avatar dechimp avatar dominicbraam avatar e0i avatar emarref avatar fbuys avatar jd7h avatar jrnk avatar jvenant avatar keelerm84 avatar marcaddeo avatar matt-deacalion avatar milesmatthias avatar mralexandernickel avatar namdnguyen avatar naps62 avatar patrickdavey avatar phlipper avatar rfunduk avatar samg avatar smcabrera avatar stevenghyselbrecht avatar trliner avatar tsfoster avatar underpantsgnome avatar walski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timetrap's Issues

Notes on "t out"

Hi, very helpful tool :)

I've built almost the same as a small sinatra app for fun, but I'm too lazy to extend it, quite nice for the cmd line!

One suggestion: It would be very helpful to have the NOTES param also at t out, as I, most of the time only know at the end of my work, what exactly I did :)

undefined method `[]' for #<Enumerator:0x0000010098b6e0>

Hi,
I'm facing a problem when I want to display the current timesheet.

There is the trace :

Lain-ux@nyarlathothep:~ > tt d
/Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:32:in `block (2 levels) in initialize': undefined method `[]' for # (NoMethodError)
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:20:in `each'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:20:in `each_with_index'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:20:in `block in initialize'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:14:in `each'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/formatters/text.rb:14:in `initialize'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap.rb:70:in `new'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap.rb:70:in `format'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/cli.rb:172:in `display'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/cli.rb:84:in `invoke_command_if_valid'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/lib/timetrap/cli.rb:68:in `invoke'
    from /Users/lainux/.gem/ruby/1.9.1/gems/timetrap-1.2.1/bin/t:11:in `'
    from .gem/ruby/1.9.1/bin/t:19:in `load'
    from .gem/ruby/1.9.1/bin/t:19:in `'

I use Ruby 1.9.1 as you can see in the path.

Thanks

Mayeu

suppress kill verification

I just started looking at timetrap last night. Very nicely done. I have a simple feature request. It would be very useful to have the ability to suppress verification on commands like kill with a --force flag or something similar. Thanks for your work. I might actually start keeping track of my time now :)

ID for timesheets

A feature that would be great was if all timesheets had an ID as well, like:

[1] Project_1
[2] Project_2
[3] L_A_H
[4] P69991

Then it could be possible to change to a timesheet like this:

t s 4

Would be a bit quicker on the command line.

(ExclusiveTimeSheets) Allow config to prevent conurrently running tasks

I personaly prefer counting one minute of my work just to one timesheet.
There are others, who are happy to have multiple activites running in multiple sheets, but to me it gives unecessary complexity, forcing me to call "t out" before I switch to another sheet.

Simple Proposal (SheetsAreExclusive)

Allow to configure option SheetsAreExclusive. If true, any call to t in or t sheet command would autoatically call t out for possibly running task. This way it would prevent concurrent tasks and at the same time would simplify use.

(too) complex proposal (ExclusiveTimeSheets selection)

If I would like to have some sheets tracking total time I spent at the office in the day, and all remaining sheets would be used only exclusively without a chance to overlap in time, then we need a method for distinguishing these two different types (Exclusive and Concurrent).

For this, we could use some sort of wildcard.

Option could be named ExclusiveTimeSheets and by default would be empty (to keep existing behaviour).

In case I would need sheet office as concurrent and remaining sheets (clientA, clientB...) as exclusive, I would set ExclusiveTimeSheet option to expression telling either "select all names starting with Client" or "select all names but office".

Whatever selection criteria are fine (LIKE operators, SQLite expressons, some ruby native wildcard matching...)

Conclusion

I prefer simpler one, but could live with complex one too.

Standalone Gem

Would be great if I could run this standalone.

Would make it easier to integrate with alfred and what not.

--at switch not synching to my timezone

Heya, I love this gem!

However, I'm having an issue when I clock in, then clock out with an --at. It oftentimes adds an extra 24 hours because it thinks that it's at GMT, so I have to specify that it is still today where I am by putting the date into the command This is, as you might imagine, a bit cumbersome.

It may also occur during editing.

I'm running ubuntu and have my timezone set to Pacific.

Thanks!

Readline support for sheet names

Using git inside bash offers awesome tab-completion for branch names, command options etc.

It would be great if this could be implemented for TimeTrap too.

Initial implementation could support just sheet names - then if I would tab-complete my sheet name, I would know, it is properly spelled.

Implementation wold have to be probably optional as some environments do not have ti provide readline functionality easily or by default.

Archived sheets should not be tab-completed.

I keep intentionaly other readline related ideas out of this issue to make it easier to complete.

Add display filter

Add a ability to display only certain "ids" or filter based the "Notes" content. Maybe passing in a regex? It should be straight forward I guess....

Great tool BTW :D Thanks!

Comparison of Fixnum with String failed

I edited an entry today and it was named with a number before the text, but now "t d all" does not work. Output of all commands with parameter all gives an error:

Comparison of Fixnum with String failed

or

Comparison of String with 10509 failed

Other commands seems to work like "t d "

Ability to set path to sqlite

Hey,

Just wanted to suggest a way to set the path to sqlite DB so that we can put the DB under dropbox and make it sync over a couple of machines. Right now I see that the path is based on the ENV[HOME]/timetrap.db

`t month` bug

bas@n041141 ~ $ t month
private method `to_date' called for Sun Dec 16 12:00:00 +0100 2012:Time
bas@n041141 ~ $ t d
Timesheet: talen en automaten
    Day                Start      End        Duration   Notes
    Wed Nov 21, 2012   12:53:42 - 14:30:22   1:36:40    wc1 voorbereiden
                       15:30:00 - 17:30:00   2:00:00    
                                             3:36:40
    Wed Nov 28, 2012   11:35:23 - 15:18:38   3:43:15    wc 1 en 2 nakijken
                       15:30:00 - 17:30:00   2:00:00    
                                             5:43:15
    Tue Dec 04, 2012   13:55:34 - 14:37:04   0:41:30    nakijken
                       21:56:28 - 01:03:12   3:06:44    nakijken
                                             3:48:14
    Wed Dec 05, 2012   10:04:57 - 11:35:51   1:30:54    nakijken
                                             1:30:54
    ---------------------------------------------------------
    Total                                   14:39:03
bas@n041141 ~ $ t --version

t: version dated Wed Dec 05 11:41:51 +0100 2012

Getopt-declare gem breaks in Ruby 2.0.0-p0

When using timetrap in ruby 2.0.0-p0 the following error occurs:

getopt-declare-1.29/lib/Getopt/Declare.rb:1411: invalid multibyte escape: /\255/ (SyntaxError)

The line in question

# lib/Getopt/Declare.rb:1411
usage.gsub!(/\255/,"[/") 

Full trace:

/Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/getopt-declare-1.29/lib/Getopt/Declare.rb:1411: invalid multibyte escape: /\255/ (SyntaxError)
from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/timetrap-1.8.5/lib/timetrap.rb:8:in `<top (required)>'
from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/timetrap-1.8.5/bin/t:3:in `<top (required)>'
from /Users/user/.rbenv/versions/2.0.0-p0/bin/t:23:in `load'
from /Users/user/.rbenv/versions/2.0.0-p0/bin/t:23:in `<main>'

gem install not working

In the install directions, it says run "gem install timetrap".

From what I can tell, it installs correctly, but there is no executable found. Here is my output:

$ sudo gem install timetrap
Successfully installed timetrap-1.7.4
1 gem installed
Installing ri documentation for timetrap-1.7.4...
Installing RDoc documentation for timetrap-1.7.4...

$ t
bash: /usr/local/bin/t: No such file or directory

I'm running Ubuntu 11.04 system. Thanks

sqlite3-ruby dependency

FYI, when installing the timetrap gem today,

#######################################################

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3. Rather than
installing sqlite3-ruby, you should install sqlite3. Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3

#######################################################

config option for default display

add a config param to .timetrap.yml
default_command: display

when i run just 't' with no params, it would use the params in the yml file.

database location in config

I think the database location in the .yml config file is not read if there is a database in the default location.

TypeError in Chronic gem parsing time (Ruby 1.9.2 only)

I'm getting issues with editing times. I've tried the following (from your README):
works
$ t in test
$ t out --at "in 30 minutes)

doesn't work
$ t in test
$ t edit --end "tomorrow at noon" (fails and falls back to Time.parse)
$ t out
$ t edit --id 4 --start "today at 11:00am" (fails and falls back to Time.parse)

These seem to be proper according to the chronic gem and your examples. What might be the issue?

allow in and out of an item on the same line

I'd like to be able to write a one line expression for creating an item. sometimes i'm not at a computer, or not at my home computer, and can't enter a time right away. now i have to do something like this:

$ t in --at "14:00" stuff
$ t out

what i'd like to do is:

$ t in --at "14:00" "stuff i'm going to do" out --at "16:00"

Move entries to another timesheet

It would be nice to have an option to move entries to another timesheet if they was entered wrongly in the first place, like f.ex:

t e -i 670 -sh Project_P67889

Is this a possible feature request?

Output multiple sheets in the same data set

It'd be useful to be able to output a file showing entries from multiple sheets (along with an added column for each sheet's name). I took a quick look at the code and it looks like this will require more than a custom formatter. I've made a fork of the project and might try this out in a little while.

Multiple timers running

Would be great if I can have multiple timers running

t in -s workaholic '10/1/11'
t in -s client 'making magical goodness for story x' #

t now
[0 workaholic: 10/1/11] 01:15:00
[1 client: making magical...] 01:15:00

t in -s client 'pairing with JimBob'

t now
[0 workaholic: 10/1/11] 01:20:00
[1 client: making magical...] 01:20:00
[2 client: pairing with JimBob] 00:05:00

t out 2

t now
[0 workaholic: 10/1/11] 01:30:00
[1 client: making magical...] 01:30:00

t out -s client

t now
[0 workaholic: 10/1/11] 01:45:00

timetrap ignores `t in` (private method `gsub!' called)

When trying to run t in timetrap outputs following message:
private method gsub!' called for Thu Oct 28 13:52:21 +0200 2010:Time Ast nowshows, it ignores the whole thing completly. Even after the silentt outthe database shows no entries. Although I initially switched to a specific sheet that also appears in the database as active,t list` reports
No sheets found

Environment:
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
sqlite3-ruby (1.3.1)
timetrap (1.4.0)

Configure option for forced rounding UP

Is it possible to tell timetrap on round to always rounding up?

I sometimes have very small time entries and want to round it up to 5 minutes duration. I configured timetrap to round on 300 seconds but on small entries i inly get 0:00:00.

Fetaure request: Option to show sheet name and date for entries

It would be a good option if there could be an option for Timetrap that could show which sheet an entry belongs to as well as the date, f.ex:

t d -x all | grep -i contact

would give

10:00:10 - 11:00:00 1:00:10 Meeting with contact [Sheet name: 10.01.2011]
10:00:10 - 11:00:00 1:00:10 Meeting with contact [Sheet name: 12.01.2011]

some cli mistakes with --at lead to unexpected behavior

Today i accidentally (not for the first time though) used a different cli-format with an equal sign instead of space delimiter in timetrap:
t out --at="18 minutes ago"
It neither gracefully handled my mistake, nor thrown any error nor any other message.
t d showed: 15:55:16 - 00:00:00-304:04:44

Thanks to the t edit function this is not a big problem once spotted.

For some reason this error doesn't happen every time.
I could only reproduce it with some times like 18 minutes ago and only with the equation sign that seems to be handled sometimes better than others.

Thanks in advance!

"Time to work" per day and Status

Hi again,

One more thing, in my quick and dirty timesheet app I included the following:

I specify the duration of a common work day in my config, e.g. 8 hours
And in addition I have something like "t status" which returns:
Working (4:31 worked, -3:29 left) or
Paused (4:31 worked, -3:29 left)

And the same for the week in "t display"
This lets me:
a) quickly estimate over-hours and when I can leave the office :)
b) I'm using the status (Working/Paused) in my taskbar, so I can imedeately see if the timer is running and if not, click on the taskbar to start it.

Very useful in my opinion

Append notes

It would be really great to append notes to the current task. E.g. I often record what I've worked in issue from our issue tracker (but it is not relevant how long I require for which task).

This means

t in PRJOECT-ISSUEID
t now
copy output to t in
t in COPIEDOUTPUT OTHERPROJECT-ISSUEID

it would be so great to do a

t in ISSUE
t append ANOTHER_ISSUE

wdyt?

Feature request: t edit --sheet [SHEET] option

Hi,

Been using this a bit now and I love it. Just thought of one more... what about an option to move an entry to a different sheet. For example, if I clock in on the wrong sheet, it would be awesome to be able (from the current sheet) to do 't edit --id # --sheet [SHEET-NAME] to have the entry move from the current sheet to a destination, SHEET-NAME.

On a vaguely related note, the option to rename sheets might be nice. I suppose I can do this by editing the raw data, though? Haven't dug around a ton with that, yet, so pardon if that's obvious.

Thanks,
John

A “today” filter

Would it be possible to integrate a filter that, like the ‘week’ or ‘month’ command, seperates out only what time I've logged for the current day? I've been working around with t d all --start "today" but I sure wouldn't mind having functionality like this baked in.

Renaming a sheet

Example:

I create the sheet "Sheet", and start tracking time. Later I want to rename it to something sane, without moving all 50 entries I've added to it individually.

Is this possible?

sync entries from different devices

if i'm working on a remote computer, i'd like to be able to write commands into a file, sync it via dropbox, then when i get home, have timetrap parse the comands to enter them into the database. something like:

$ t --batch "~/dropbox/my_timetrap_data.txt"

`t edit`, when there is no running entry defaulting to the last one

I use t edit -z aditional note (--append quite) often.

However, if I run it after t out, when there is no running entry, then it complains canẗ find entry.

It would be great, if t edit woudl default to running or last running entry, in the simliar fassion as t resume does.

There is one scenario different then t resume, after change of a sheet:

  1. t sheet one
  2. t in basic note
  3. t edit -z this note works already now, as we have runnung entry
  4. t out
  5. t edit -z adding note to the same entry as would resume pick
  6. t sheet another
  7. t edit -z adding note, which shall go to the last task (in sheet one)

I you feel, this could be tricky in some situation, there could come confirmation with message like:
Trying to append note to task in sheet >one<, which is not current one!!! Proceed? (Y/n)

There is no need for confirmation in case, we are appending to task in current sheet.

colors

any ways to output colors, mostly with the t display I would assume?

list of all sheets, even unused ones

I just installed this and was "setting up" but creating the sheets I know I'll use. I found it odd that 't list' only listed the most recently created sheet. For example:

t sheet proj1
t sheet proj2
t sheet proj3
t list

Seems to only produce 'proj3 00:00:00...'

How can I list all my sheets? I just clocked into two of them just to see if they'd show up, and now those two do, but the last one is still not shown on 't list.' Primarily, if someone wanted to set everything up on the front end... this makes them need to remember what, specifically, they named every project since there seems to be no built in way to query all sheets, even empty ones.

Great project -- thanks for your work!

Feature request: Timefactor

Hi again. :-)
Hope the request istn't too much effort.

Timefactor

The idea is to include an optional factor in each entry (default obviously "1").
That factor would be multiplied at display-time with the duration of that entry while keeping the start and end fields intact. As result there would be a derived value representing the
effort or amount of time put into the task vs the duration of time.

Use cases

Background is, that one might consider to reduce the accounted hours of one task for several reasons.
For example communications overhead like phone calls often contain off topic conversation time (or time accounted to different projects). That factor would allow to set the effectiveness of the call e.g. * 0.4 or 40%.

If the project approaches budget limit you could do the same thing with different tasks, that you feel appropriate to be reduced or maybe even taken out completely -> factor 0. ("what the h.. did i just spend x hours on something apt-get install could have been able to do in 3 minutes‽")

The difference to just editing the real duration would be, that you keep track of the overhead or given "discounts" (After all, even the overhead might be allowed to be accounted... it just doesn't feel "fair"). And more important, that you would be able to report that to customer, boss or project-owner etc. ;-)

Someone also could use it to account time with different amounts of People working at the same thing (think pair programming) and all sorts of different situations.

Additional thoughts

Would this work with an existing database? Or would this result in some kind of migration?

Some sort of indicator which entries are differently calculated would be nice. (maybe an asterisk on the duration, unless a factor/modification column gets displayed)

Thanks for timetrap! :-)
Tim

incorrect duration on edited entry

Hi sam,

Wondering if you could help me, I somehow ended up with this timesheet on my first try


[anthony@notamac ~]$ t display
Timesheet: bh60
    Day                Start      End        Duration   Notes
    Fri Jan 22, 2010   13:54:28 - 15:17:28   1:23:00    bh train 2D in proxy workflow
                       15:18:11 - 16:40:00  25:21:49    working on shakeproxy
                       16:52:01 - 17:07:21   0:15:20    bh train 2D in proxy workflow
                       17:10:38 - 17:22:02   0:11:24    playing with tasktrap!
                       17:25:38 - 17:33:41   0:08:03    ciggie
                                            27:19:36
    ---------------------------------------------------------
    Total                                   27:19:36

note the 2nd entry from 15:18:11 - 16:40:00 has a duration of 25:21:49 instead of 1:21:49
i didn't notice this till the end of the day, but heres the relevant history i could find , as you can see i edited this entry


  831  t switch bh
  832  t in bh train 2D in proxy workflow
  833  display
  834  t display
  835  t display
  836  t display
  837  t display
  838  t out
  839  t display
  840  t in working on shakeproxy
  841  t display
  842  t display
  843  t out
  844  t display
  845  t display --ids
  846  t in bh train 2D in proxy workflow --at "20 minutes ago"
  847  t display
  848  t out --at "5 minutes ago"
  849  t display
  850  t display 3
  851  t display --ids
  852  t out
  853  t display --ids
  854  t --id edit 2 --end 16:40
  855  t edit --id 2 --end 16:40
  856  t display -
  857  t display 
  858  t in playing with tasktrap! --at "5 minutes ago"
  859  t  now
  860  t in playing with tasktrap! --at "5 minutes ago"
  861  t out playing with tasktrap! --at "10 minutes ago"
  862  t display
  863  t now
  864  t in ciggie --at "8 minutes ago"
  865  t out

version info:


[anthony@notamac ~]$ ruby --version
ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-linux]
[anthony@notamac ~]$ t --version
t: version dated Fri Jan 22 13:50:57 +1100 2010

[anthony@notamac ~]$ cat /etc/issue
Fedora release 10 (Cambridge)
Kernel \r on an \m (\l)
[anthony@notamac ~]$ uname -a
Linux notamac 2.6.27.41-170.2.117.fc10.i686 #1 SMP Thu Dec 10 11:00:29 EST 2009 i686 i686 i386 GNU/Linux

dependencies:

sequel (3.8.0)
sqlite3-ruby (1.2.5)
chronic (0.2.3)
getopt-declare (1.28)
icalendar (1.1.0)
mime-types (1.16)
diff-lcs (1.1.2)

Thanks
Ant

Sync with Harvest

HarvestApp is great, but it's kinda clunky. I love using timetrap on my machine. Would be great to sync with harvest dynamically.

numeric names for sheets don't work

to reproduce the error, try this:

t sheet 3871
t in something
t out
t list
t kill 3871

(you will get errors if you try to get a complete list of all sheets, and you won't be able to kill the numeric sheet.)

if this happens to you, you can do this:

t sheet good_sheet
t sheet good_sheet
t backend

update entires set sheet = 'pc3871' where sheet = '3871';

and everything will work fine again.

i suggest, as a quick & easy fix, to check if sheet names are numeric-only, and stop with an error. alternatively, it would be nice to make numeric names legal.

i'm very happy with this tool, though. this is what all software should look & feel like. :-) thanks!

Allow resuming specific task, which is not the last one

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.

t now command when not on a task

It's not a huge deal, but I've been working on getting timetrap to output into tmux status bars. The problem I've been having with displaying the currently running task, is that if I'm not on a task it just displays the "not running" message.

My suggestion would be to put that message to standard error instead of standard out. That way you wouldn't have to check the content of the message to prevent displaying it.

I'd be happy to submit a pull request if this is something you think would be useful.

Feature Req: Tags/Projects/Categories

I would love to have the ability to tag my entries or to file them into a project/category. I find that having only time sheets and tasks is a bit too restrictive, especially for clients. The easiest implementation would be to add tags with the following syntax:

t in working on psd +design

(where "design" is the tag/category)

Then have the tag parsed out of the notes and add a foreign key on entries pointing to a tags table. Finally in the formatter you could add a column for tags, display it with the notes or allow the user to display items from a specific tag.

A more complete implementation would be to allow the user to create projects within a timesheet. Each project would act as a timesheet of its own, and the main timesheet would summarize the times of each sub-project, along with global entries...

Anyways, awesome project and I look forward to the future of TimeTrap. :)

Adding ERB support to .timetrap.yml

Hey, guys. You've got a really nice tool, here. Ok... on with the feature request! ;)

I've got a setup where I regularly use multiple computers when I work. Both computers share the same MobileMe iDisk, so I'd really like to keep my .timetrap.db there and have both computers automatically reference the same file.

My Documents folder is actually sym-linked from my home directory on both OS X boxes, so I can refer to my .timetrap.rb as "~/Documents/.timetrap.rb". Unfortunately, a standard YAML.load doesn't know how to expand the ~ to the correct home directory folder.

This problem, and potentially several others, would be solved if timetrap processed the .yml file through ERB, before the YAML.load. This is what Rails does, btw. That would allow me to use this for my database_file value:

<%= File.expand_path("~/Documents/.timetrap.rb") %>

Which would automatically point to the shared location, from both of my computers, without me needing to hard-code different fully-qualified paths.

I've looked at the code in lib/timetrap/config.rb and adding the ERB processing would only add a few lines of additional code and almost no additional time lag, as the .yml is so small.

If you like, I've forked the project and would be happy to submit a pull request...

-Brian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.