| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::tt; |
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
65
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
1; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=encoding utf8 |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
App::tt - Time tracking application |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
0.17 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
L is an application that can track how much time you spend on an |
|
22
|
|
|
|
|
|
|
project from command line. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
It is inspired by L and share the same log file format, |
|
25
|
|
|
|
|
|
|
but it has (in my humble opinion) a simpler interface and easier to install. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The application is built up by specifying an command and optional arguments. |
|
30
|
|
|
|
|
|
|
Here is a list of example usages, but you can get more details by adding "-h" |
|
31
|
|
|
|
|
|
|
after each command. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Start tracking time |
|
34
|
|
|
|
|
|
|
$ tt start |
|
35
|
|
|
|
|
|
|
$ tt start -p project-name |
|
36
|
|
|
|
|
|
|
$ tt start -p project-name -t tag1,tag2 |
|
37
|
|
|
|
|
|
|
$ tt start -p project-name -t tag1,tag2 09:03 |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Current status |
|
40
|
|
|
|
|
|
|
$ tt |
|
41
|
|
|
|
|
|
|
$ tt status |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Stop tracking time. Specifiying a time will go back to yesterday, |
|
44
|
|
|
|
|
|
|
# in case you forgot to stop it. |
|
45
|
|
|
|
|
|
|
$ tt stop |
|
46
|
|
|
|
|
|
|
$ tt stop 18:04 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# See the log |
|
49
|
|
|
|
|
|
|
$ tt log |
|
50
|
|
|
|
|
|
|
$ tt log -0year # Log for this year |
|
51
|
|
|
|
|
|
|
$ tt log -1year -t meetings # Log for last year, for tag "meetings" |
|
52
|
|
|
|
|
|
|
$ tt log -p project-name -1month # Log for last month, for project "project-name" |
|
53
|
|
|
|
|
|
|
$ tt log -2 # Log for two months back |
|
54
|
|
|
|
|
|
|
$ tt export -1 # Export as CSV |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Edit the last entry, or a specific file |
|
57
|
|
|
|
|
|
|
$ tt edit |
|
58
|
|
|
|
|
|
|
$ tt edit ~/.TimeTracker/2020/01/20200106-150000_nms.trc |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Register forgotten time |
|
61
|
|
|
|
|
|
|
$ tt register 2020-01-01T09:00:00 17:00:00 -p "project-name" |
|
62
|
|
|
|
|
|
|
$ tt register 2020-01-01T09:00:00 17:00:00 -p "project-name" -t "tag1,tag2" |
|
63
|
|
|
|
|
|
|
$ tt register 2020-01-01T09:00:00 17:00:00 -p "project-name" -d "description" -t "tag1,tag2" |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Basic usage; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Start to track time |
|
68
|
|
|
|
|
|
|
$ cd $HOME/git/my-project |
|
69
|
|
|
|
|
|
|
$ tt start |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Work, work, work, cd ..., do other stuff |
|
72
|
|
|
|
|
|
|
$ tt stop |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
A more complex example: |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Start to work on an event and add a tag |
|
77
|
|
|
|
|
|
|
$ tt start -t ISSUE-999 -p some-project-at-work |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Add another tag to the same event and add a --comment and specify when |
|
80
|
|
|
|
|
|
|
# you stopped working |
|
81
|
|
|
|
|
|
|
$ tt stop -t GITHUB-1005 "Today I was mostly in meetings" 15:24 |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 CONFIG |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Default configuration can be read from either C<$PWD/.env> or |
|
86
|
|
|
|
|
|
|
C<$HOME/.TimeTracker/config>. Here is an example config file with default |
|
87
|
|
|
|
|
|
|
settings: |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# some comment |
|
90
|
|
|
|
|
|
|
editor=nano |
|
91
|
|
|
|
|
|
|
export_columns=date,project,hours,rounded,tags,description |
|
92
|
|
|
|
|
|
|
hours_per_month=0 # Used to calculate how much you have to work |
|
93
|
|
|
|
|
|
|
min_time=300 # Will drop the task on "tt stop" if started less than 300 seconds |
|
94
|
|
|
|
|
|
|
round_up_at=30 # Used by the export comnmand to round hours |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Can also use the environment aliases: |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
EDITOR=vim |
|
99
|
|
|
|
|
|
|
TT_COLUMNS=date,project |
|
100
|
|
|
|
|
|
|
TT_HOURS_PER_MONTH=150 |
|
101
|
|
|
|
|
|
|
TT_MIN_TIME=600 |
|
102
|
|
|
|
|
|
|
TT_ROUND_UP_AT=15 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 ACTIONS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Each command can tak C<-h> for more details. Example: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$ tt start -h |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 edit |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This command can be used to rewrite a log entry. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# Edit the last entry with your favorite $EDITOR |
|
115
|
|
|
|
|
|
|
$ tt edit |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Edit a given file with your favorite $EDITOR |
|
118
|
|
|
|
|
|
|
$ tt edit ~/.TimeTracker/2017/12/20171220-092000_rg.trc |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# Rewrite all the log entries with a perl script |
|
121
|
|
|
|
|
|
|
# See source code before running this command. (Internals might change) |
|
122
|
|
|
|
|
|
|
$ cat rewrite.pl | tt edit |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 export |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This will export a given set of records as CSV. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$ tt export # this month |
|
129
|
|
|
|
|
|
|
$ tt export -2 # two months ago |
|
130
|
|
|
|
|
|
|
$ tt export year # log for year |
|
131
|
|
|
|
|
|
|
$ tt export -1y # last year |
|
132
|
|
|
|
|
|
|
$ tt export -p foo # Filter by project name |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 log |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This command will report how much time you have spent on various |
|
137
|
|
|
|
|
|
|
events. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$ tt log # this month |
|
140
|
|
|
|
|
|
|
$ tt log -2 # two months ago |
|
141
|
|
|
|
|
|
|
$ tt log year # log for year |
|
142
|
|
|
|
|
|
|
$ tt log -1y # last year |
|
143
|
|
|
|
|
|
|
$ tt log -p foo # Filter by project name |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
If you set the "TT_HOURS_PER_MONTH" environment variable to the number of hours |
|
146
|
|
|
|
|
|
|
you plan to work per month, then "tt log" will also print how many hours you |
|
147
|
|
|
|
|
|
|
have to work in average to meet the target. Example: |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
$ TT_HOURS_PER_MONTH=150 tt log -p my_job |
|
150
|
|
|
|
|
|
|
... |
|
151
|
|
|
|
|
|
|
Remaining this month: 21d, 7:08h/d. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 register |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This command is used to import data from other sources. "project-name" default to |
|
156
|
|
|
|
|
|
|
"-p" or current git project, "some description" default to "-d" and tags can be |
|
157
|
|
|
|
|
|
|
specified by -t foo -t bar |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$ tt register 2020-01-01T09:00:00 17:00:00 -p project-name -d "some description" -t foo -t bar |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 start |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This command will start tracking a new event. It will also stop the current |
|
164
|
|
|
|
|
|
|
event if any event is in process. This command takes the "-p" and "-t" |
|
165
|
|
|
|
|
|
|
switches. "-p" (project) is not required if you start from a git repository. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# Specify a tag and custom project name |
|
168
|
|
|
|
|
|
|
$ tt start -t ISSUE-999 some-project-name |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# Started working at 08:00 instead of now |
|
171
|
|
|
|
|
|
|
$ tt start 08:00 |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 status |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This is the default command and will return the current status: |
|
176
|
|
|
|
|
|
|
Are you working on something or not? |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
$ tt status |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 stop |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This command will stop tracking the current event. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# Stop working at 16:00 instead of now |
|
185
|
|
|
|
|
|
|
$ tt stop 16:00 |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Copyright (C) 2014, Jan Henning Thorsen |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
|
192
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 AUTHOR |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Jan Henning Thorsen - C |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |