https://github.com/nicolai86/traq
time tracking /w your terminal
https://github.com/nicolai86/traq
cli timetracking
Last synced: 13 days ago
JSON representation
time tracking /w your terminal
- Host: GitHub
- URL: https://github.com/nicolai86/traq
- Owner: nicolai86
- License: mit
- Created: 2012-12-14T18:24:51.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T19:38:57.000Z (over 7 years ago)
- Last Synced: 2025-06-15T09:39:40.632Z (8 months ago)
- Topics: cli, timetracking
- Language: Go
- Homepage: http://blog.nicolai86.eu/posts/2012-12-14/introducing-traq/
- Size: 94.7 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# traq

time tracking using text files
## Usage examples
``` bash
# 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
``` bash
$ 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:
``` bash
$ mkdir -p $HOME/go/src
$ ln -s $HOME/.traq/src/ $HOME/go/src/traq
```
``` bash
$ go build -o bin/traq app.go
```
### Go Formatting
``` bash
$ 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][1] and have `bash-completion` installed.
``` bash
$ ln -s $TRAQ_PATH/traq_completion.sh $(brew --prefix)/etc/bash_completion.d/traq
```
Ubuntu users can do the following:
``` bash
$ 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:
```bash
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//--
# eg $TRAQ_DATA_DIR/timestamps/2012/2012-12-12
or, if `-p ` was given, under
$ $TRAQ_DATA_DIR///--
# eg $TRAQ_DATA_DIR/client-a/2012/2012-12-12
Each file can contain multiple lines of the following format:
;;
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;
[1]:http://mxcl.github.com/homebrew/