Skip to content

Commit 667ea59

Browse files
committed
initial commit
1 parent 161bf58 commit 667ea59

20 files changed

Lines changed: 1292 additions & 0 deletions

File tree

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Go workspace file
15+
*.workspace
16+
17+
# IDE and Editor directories and files
18+
.vscode/
19+
.idea/
20+
*.sublime-project
21+
*.sublime-workspace
22+
23+
# macOS files
24+
.DS_Store
25+
26+
# Windows files
27+
Thumbs.db
28+
29+
# Logs
30+
*.log
31+
32+
# Database files
33+
*.db
34+
35+
36+
# Environment variables
37+
.env
38+
.env.local
39+
.env.*.local
40+
41+
# Build directories
42+
/bin/

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Makefile for timetracker
2+
3+
# Directories
4+
SERVER_DIR=cmd/server
5+
CLIENT_DIR=cmd/client
6+
7+
# Binaries
8+
SERVER_BIN=bin/timetrackerd
9+
CLIENT_BIN=bin/timetracker-cli
10+
11+
# Default target
12+
.PHONY: all build lint test clean run-server
13+
14+
all: build
15+
16+
# Build both server and client
17+
build: build-server build-client
18+
19+
# Build server binary
20+
build-server:
21+
@echo "Building server..."
22+
@mkdir -p bin
23+
go build -o $(SERVER_BIN) $(SERVER_DIR)/main.go
24+
25+
# Build client binary
26+
build-client:
27+
@echo "Building client..."
28+
@mkdir -p bin
29+
go build -o $(CLIENT_BIN) $(CLIENT_DIR)/main.go
30+
31+
# Format code using go fmt
32+
fmt:
33+
@echo "Formatting code..."
34+
go fmt ./...
35+
36+
# Vet code using go vet
37+
vet:
38+
@echo "Running go vet..."
39+
go vet ./...
40+
41+
# Lint code by formatting and vetting
42+
lint: fmt vet
43+
44+
# Run tests
45+
test:
46+
@echo "Running tests..."
47+
go test ./... -v
48+
49+
# Clean build artifacts
50+
clean:
51+
@echo "Cleaning build artifacts..."
52+
rm -rf bin
53+
54+
# Run server
55+
run-server: build-server
56+
@echo "Running server..."
57+
$(SERVER_BIN) -config=./team-timetracker-server.sample.json
58+

README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Timetracker
2+
3+
TimeTracker is a robust command-line interface (CLI) and server application designed to help teams to efficiently track time spent on various URLs, such as GitHub issues, project management tasks, or any web-based activities. By seamlessly integrating with your workflow, TimeTracker allows you to start and stop time entries, view detailed logs, and export data in multiple formats.
4+
5+
## Getting started
6+
7+
### Download the Binaries
8+
9+
Get the binaries from the releases or download/clone the source code and build it manually
10+
11+
### Manual Building
12+
13+
### Building the server
14+
15+
Executing `make build-server` is enough, a binary named `timetrackerd` should be created in the `bin` directory
16+
17+
### Building the CLI
18+
19+
Executing `make build-client` will create a binary named `timetracker` in the `bin` directory
20+
21+
### Running the server
22+
23+
#### Sample server configuration
24+
25+
```json
26+
{
27+
"server": {
28+
"addr": "0.0.0.0:8080",
29+
"allowed_origins": ["*"]
30+
},
31+
"database": {
32+
"driver": "sqlite",
33+
"data_source": "timetracker.db"
34+
}
35+
}
36+
```
37+
38+
the command to run the server is `./bin/timetrackerd -config ./team-timetracker-server.sample.json`
39+
40+
### Running the client
41+
42+
The client has 3 main commands `start`, `stop`, `entries`
43+
44+
#### Client configurations
45+
46+
The client requires configuration either passed as `-config` flag or in `~/.config/team-timetracker.json` that has the username and backend URL
47+
48+
```json
49+
{
50+
"username": "xmonader",
51+
"backend_url": "http://localhost:8080"
52+
}
53+
```
54+
55+
#### Start time entry
56+
57+
```
58+
~> ./bin/timetracker start github.com/theissues/issue/142 "helllooo starting"
59+
Started tracking ID 9 for URL 'github.com/theissues/issue/142'.
60+
```
61+
62+
It takes the URL as an argument and a description and returns you a tracking ID
63+
> Note: you can't start an already started entry.
64+
65+
#### Stop time entry
66+
67+
```
68+
~> ./bin/timetracker stop github.com/theissues/issue/142
69+
70+
Stopped tracking for URL 'github.com/theissues/issue/142'. Duration: 35 minutes.
71+
```
72+
73+
#### Querying the time entries
74+
75+
> You can generate CSV data by specifying --format=csv
76+
77+
##### Querying all of the entries
78+
79+
```
80+
~> ./bin/timetracker-cli entries
81+
Time Entries:
82+
------------------------------
83+
ID: 9
84+
Username: azmy
85+
URL: github.com/theissues/issue/154
86+
Description: helllooo starting
87+
Start Time: Sun, 15 Sep 2024 22:08:01 EEST
88+
End Time: Sun, 15 Sep 2024 22:08:14 EEST
89+
Duration: 3 minutes
90+
------------------------------
91+
ID: 8
92+
Username: xmonader
93+
URL: github.com/theissues/issue/112
94+
Description: hello 142
95+
Start Time: Sun, 15 Sep 2024 22:07:10 EEST
96+
End Time: Sun, 15 Sep 2024 22:07:12 EEST
97+
Duration: 42 minutes
98+
------------------------------
99+
ID: 7
100+
Username: xmonader
101+
URL: github.com/theissues/issue/52111
102+
Description: the descrpition
103+
Start Time: Sun, 15 Sep 2024 22:06:55 EEST
104+
End Time: Sun, 15 Sep 2024 22:06:58 EEST
105+
Duration: 11 minutes
106+
------------------------------
107+
ID: 6
108+
Username: guido
109+
URL: github.com/theissues/issue/4
110+
Description: alright done
111+
Start Time: Sun, 15 Sep 2024 22:03:59 EEST
112+
End Time: Sun, 15 Sep 2024 22:04:09 EEST
113+
Duration: 20 minutes
114+
------------------------------
115+
ID: 5
116+
Username: guido
117+
URL: github.com/rfs/issue/87
118+
Description: that's tough
119+
Start Time: Sun, 15 Sep 2024 22:03:00 EEST
120+
End Time: Sun, 15 Sep 2024 22:03:04 EEST
121+
Duration: 15 minutes
122+
------------------------------
123+
ID: 4
124+
Username: xmonader
125+
URL: github.com/zos/issue/414
126+
Description: woh
127+
Start Time: Sun, 15 Sep 2024 22:02:26 EEST
128+
End Time: Sun, 15 Sep 2024 22:02:41 EEST
129+
Duration: 33 minutes
130+
------------------------------
131+
ID: 3
132+
Username: xmonader
133+
URL: github.com/thesites/www_what_io
134+
Description: another desc1123
135+
Start Time: Sun, 15 Sep 2024 22:00:13 EEST
136+
End Time: ---
137+
Duration: ---
138+
------------------------------
139+
ID: 2
140+
Username: ahmed
141+
URL: https://github.com/xmonader/team-timetracker/issues/121
142+
Description: el desc
143+
Start Time: Sun, 15 Sep 2024 20:03:56 EEST
144+
End Time: Sun, 15 Sep 2024 20:06:05 EEST
145+
Duration: 24 minutes
146+
------------------------------
147+
ID: 1
148+
Username: ahmed
149+
URL: https://github.com/xmonader/team-timetracker/issues/1
150+
Description: another desc
151+
Start Time: Sun, 15 Sep 2024 20:03:24 EEST
152+
End Time: Sun, 15 Sep 2024 20:03:50 EEST
153+
Duration: 23 minutes
154+
------------------------------
155+
```
156+
157+
###### Generating CSV data
158+
159+
```
160+
~> ./bin/timetracker-cli entries --format=csv
161+
ID,Username,URL,Description,Start Time,End Time,Duration (minutes),Created At,Updated At
162+
9,azmy,github.com/theissues/issue/154,helllooo starting,2024-09-15T22:08:01+03:00,2024-09-15T22:08:14+03:00,3,2024-09-15T22:08:01+03:00,2024-09-15T22:08:14+03:00
163+
8,xmonader,github.com/theissues/issue/112,hello 142,2024-09-15T22:07:10+03:00,2024-09-15T22:07:12+03:00,42,2024-09-15T22:07:10+03:00,2024-09-15T22:07:12+03:00
164+
7,xmonader,github.com/theissues/issue/52111,the descrpition,2024-09-15T22:06:55+03:00,2024-09-15T22:06:58+03:00,11,2024-09-15T22:06:55+03:00,2024-09-15T22:06:58+03:00
165+
6,guido,github.com/theissues/issue/4,alright done,2024-09-15T22:03:59+03:00,2024-09-15T22:04:09+03:00,20,2024-09-15T22:03:59+03:00,2024-09-15T22:04:09+03:00
166+
5,guido,github.com/rfs/issue/87,that's tough,2024-09-15T22:03:00+03:00,2024-09-15T22:03:04+03:00,15,2024-09-15T22:03:00+03:00,2024-09-15T22:03:04+03:00
167+
4,xmonader,github.com/zos/issue/414,woh,2024-09-15T22:02:26+03:00,2024-09-15T22:02:41+03:00,33,2024-09-15T22:02:26+03:00,2024-09-15T22:02:41+03:00
168+
3,xmonader,github.com/thesites/www_what_io,another desc1123,2024-09-15T22:00:13+03:00,N/A,5,2024-09-15T22:00:13+03:00,2024-09-15T22:00:13+03:00
169+
2,ahmed,https://github.com/xmonader/team-timetracker/issues/121,el desc,2024-09-15T20:03:56+03:00,2024-09-15T20:06:05+03:00,24,2024-09-15T20:03:56+03:00,2024-09-15T20:06:05+03:00
170+
1,ahmed,https://github.com/xmonader/team-timetracker/issues/1,another desc,2024-09-15T20:03:24+03:00,2024-09-15T20:03:50+03:00,23,2024-09-15T20:03:24+03:00,2024-09-15T20:03:50+03:00
171+
172+
```
173+
174+
##### Querying entries by username
175+
176+
```
177+
------------------------------
178+
~> ./bin/timetracker-cli entries --username="azmy"
179+
Time Entries:
180+
------------------------------
181+
ID: 9
182+
Username: azmy
183+
URL: github.com/theissues/issue/154
184+
Description: helllooo starting
185+
Start Time: Sun, 15 Sep 2024 22:08:01 EEST
186+
End Time: Sun, 15 Sep 2024 22:08:14 EEST
187+
Duration: 3 minutes
188+
------------------------------
189+
```
190+
191+
##### Querying entries by URL
192+
193+
```
194+
~> ./bin/timetracker-cli entries --url="github.com/theissues/issue/154"
195+
Time Entries:
196+
------------------------------
197+
ID: 9
198+
Username: azmy
199+
URL: github.com/theissues/issue/154
200+
Description: helllooo starting
201+
Start Time: Sun, 15 Sep 2024 22:08:01 EEST
202+
End Time: Sun, 15 Sep 2024 22:08:14 EEST
203+
Duration: 3 minutes
204+
------------------------------
205+
```

0 commit comments

Comments
 (0)