Simple Go application for calculating hours logged and logging time in Teamwork.
This app can be used without any dependencies. Here is the documentation on how to setup the app. Than just run on UNIX:
$ ./teamwork-go-scraperFor Windows users
$ .\teamwork-go-scraper.exeFor help run:
$ ./teamwork-go-scraper -help
# String flags (must specify value -action=tag)
-action Action on which hours will be calculated (tag or projectId) (default "tag")
-startDate Must be in format YYYY-MM-DD (default "first day of current month (e.g. 2024-01-01)")
-endDate Must be in format YYYY-MM-DD (default "today (e.g. 2024-01-15)")
-t Start time when to log hours from (HH:mm) (default "09:00")
-value Value for the specified action. (default "overtime")
# Boolean flags (just passed as arguments)
-c Use for checking if there are some days where hours are not logged
-h Use for including Croatian national holidays in the calculations
-l Enter the logging mode (default: reading logged hours)
-p If selected hours will be logged by project id (default: log by task id )
-n Non billable hours in log mode (default: isBillable)
-m Check time logs for team members- Prerequisites Go users
- Usage
- Action
- Value
- Dates
- Logging hours
- Logging example
- Holidays
- Check logged-in hours
You must have a running go version locally Go.dev. Run the next command to check if you have a running go version.
$ go versionJust follow the next steps.
- Prepare teamwork API key.
- Create
config.jsonin the root - Export necessary environment variables (check
.config.json-example)- Get the
userIdfrom Teamwork
- Get the
To install the package just run:
go install github.com/aarbanas/teamwork-go-scraper/cmd@latestBy default this application is going to calculate all overtime hours logged in teamwork. Here is a list of other options:
Application is accepting two action values: tag(default) and projectId. Based on tag script is going to calculate logged hours. (e.g. if projectId is 12345 than it will return all logged hours for selected project)
go run ./cmd -action=projectIdYou can pass any -value which needs to be in the combination with -action. Default value is overtime.
go run ./cmd -action=projectId -value=123456789For dates two values can be used:
-startDate- default is first day of the current month (must be in format YYYY-MM-DD)-endDate- default is today (must be in format YYYY-MM-DD)
go run ./cmd -startDate=2024-01-01 -endDate=2024-01-15In case you want to log new hours, not check for the already logged ones than flag -l needs to be passed.
go run ./cmd -lLogging hours is selecting startDate and endDate flags, so if they are not passed the default values are used.
Using log mode is prompt couple of more questions like taskId, hours/minutes and description.
Log mode by default is logging hours by taskId, but in case hours need to be logged on the project directly there is
a flag -p.
go run ./cmd -l -pTo specify the start time use the flag -t. Time must be provided in format HH:mm
go run ./cmd -l -t=08:30go run ./cmd -l -p -startDate=2024-01-01 -endDate=2024-01-31In case you want to log hours and skip Croatian national holidays use -h flag.
go run ./cmd -l -h -startDate=2024-01-01 -endDate=2024-01-31If you want to validate if in the specified period you logged all your hours there is a flag -c made for that purpose.
Here you can add Croatian national holidays in the equation.
go run ./cmd -c -h -startDate=2024-01-01 -endDate=2024-01-31