Giter VIP home page Giter VIP logo

traq's Introduction

traq

travis build status

time tracking using text files

Usage examples

# start time tracking for #project
$ traq project

# start time tracking for #project with the comment 'working on the landing page'
$ traq project working on the landing page

# stop time tracking
$ traq stop

# echo the content of todays file to stdout. If the file does not exist, nothing is echoed.
$ traq

# echo the content of the file from the given date to stdout. If the file does not exist, nothing is echoed.
$ traq -d 2012-07-30

# echo the content of all files in february of the current year
$ traq -m 2

# echo the content of all files in september 2012
$ traq -m 9 -y 2012

# starts time tracking for client-a on #development
$ traq -p client-a development

# stops time tracking for client-a
$ traq -p client-a stop

# list tracked times for client-a from today
$ traq -p client-a

Evaluation

To evaluate traq files pass the -e command line flag to the utility. E.g.

$ traq -p test -e
2012-09-27
#foo:0.1666
#bar:0.1666
%%

Installation from source

$ go get github.com/nicolai86/traq
$ echo "export TRAQ_PATH=$GOPATH/src/github.com/nicolai86/traq" >> ~/.bash_profile
$ echo "export TRAQ_DATA_DIR=$HOME/Library/traq" >> ~/.bash_profile
$ ln -s $TRAQ_PATH/man/traq.1 /usr/local/share/man/man1/traq.1
$ . ~/.bash_profile
$ which traq

Build instructions

Make sure your $GOPATH is set up properly. Then link traq properly:

$ mkdir -p $HOME/go/src
$ ln -s $HOME/.traq/src/ $HOME/go/src/traq
$ go build -o bin/traq app.go

Go Formatting

$ gofmt -w traq.go

Bash Completion

If you have bash-completion installed you can setup bash completion for traq as well. This example assumes you are using HomeBrew and have bash-completion installed.

$ ln -s $TRAQ_PATH/traq_completion.sh $(brew --prefix)/etc/bash_completion.d/traq

Ubuntu users can do the following:

$ sudo apt-get install bash-completion
$ echo ". $TRAQ_PATH/traq_completion.sh" >> ~/.bash_profile

Migration to v0.5

traq 0.5 has a different, flatter directory structure. Instead of one directory per year week of the year, we now only have one directory per year.

The following bash script helps you migrate your data:

for directory in $(find $HOME/Library/traq -maxdepth 1 -mindepth 1 -type d); do
  echo $directory
  for year in $(find $directory -maxdepth 1 -mindepth 1 -type d); do
    for week in $(find $year -maxdepth 1 -mindepth 1 -type d); do
      for file in $(find $week -maxdepth 1 -mindepth 1 -type f); do
        cleanfile="${file//timestamps-/}"
        mv "$file" "$year/${cleanfile##*/}"
      done
      rm -fr $week
    done
  done
done

Hacking

All files are placed under

$ $TRAQ_DATA_DIR/timestamps/<current year>/<year>-<month>-<day>
# eg $TRAQ_DATA_DIR/timestamps/2012/2012-12-12

or, if -p <project> was given, under

$ $TRAQ_DATA_DIR/<project>/<current year>/<year>-<month>-<day>
# eg $TRAQ_DATA_DIR/client-a/2012/2012-12-12

Each file can contain multiple lines of the following format:

<timestamp>;<tag>;<comment>

Here's some sample content:

Thu Sep 27 07:05:05 +0400 2012;#foo;Worked on Foo
Thu Sep 27 07:15:05 +0400 2012;#bar;
Thu Sep 27 07:25:05 +0400 2012;stop;

traq's People

Contributors

nicolai86 avatar passy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

traq's Issues

allow output per month

It would be great if you could run

$ traq -p <project> -m 02
$ traq -p <project> -m 02.2012

to get all output for february, or february 2012 respectivly

place markers on following days in same file

E.g. calling

traq -p <project> work # it's 03.09.1986 23:50
traq -p <project> stop # it's 04.09.1986 00:10

will result in output in two files, and traq is currently not able to make a connection between the two.

Ideally calling stop on a following day should result in an input on the previous days entry.

Thus the above example should only generate a single file, timestamps-1986-09-03 with the following lines:

Mon Sep 03 23:50:00 +0200 1986;#work;
Tue Sep 04 00:10:00 +0200 1986;stop;

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.