A command line interface that makes working with GitLabs time tracking feature more enjoyable.
- php >= 7.0 (5.6 won't work)
Make sure composer is installed globally and ~/.composer/vendor/bin is in your PATH. Then simply run:
composer global require kriskbx/gitlab-time-tracker
coming soon
Login to gitlab.com or your own GitLab instance using a private token.
gtt login
Edit the global configuration file. Available options
gtt edit
Get a report for your project or issue.
# available report commands
gtt report ["namespace/project"] [issue_id]
gtt report:month ["2017-03"] ["namespace/project"]
gtt report:day ["2017-03-01"] ["namespace/project"]
# timeframe
git report --from="2017-03-01" --to="2017-04-01"
# include closed issues
gtt report --closed=true
# limit to a user
gtt report --user=username
# limit to a milestone
gtt report --milestone=milestone_name
# overwrite the default date format or the date format stored in your config
gtt report --date_format="d.m.Y H:i:s"
# overwrite the default columns or the columns stored in your config
gtt report --columns=iid --columns=title --columns=estimation
# only include issues and merge requests that have the following labels, overwrites the includeByLabels store in your config
gtt report --include_by_labels=critical --include_by_labels=important
# exclude issues and merge requests that have the following labels, overwrites the excludeByLabels store in your config
gtt report --exclude_by_labels=wont-fix --exclude_by_labels=ignore
# only include the given labels in the results, overwrites the includeLabels stored in your config
gtt report --include_labels=pending --include_labels=approved
# exclude the given labels from the results, overwrites the excludeLabels stored in your config
gtt report --exclude_labels=bug --exclude_labels=feature
# choose a different output than a stdout table (json coming soon)
gtt report --output=markdown --file=filename.md
gtt report --output=csv --file=filename.csv
coming soon
Here's a sample configuration file including all available options:
# url to the gitlab api. make sure there's a trailing slash
url: http://gitlab.com/api/v4/
# your api token
token: abcdefghijklmnopqrst
# default project
project: namespace/projectname
# include closed by default
closed: true
# default milestone to filter issues by
milestone: milestone_name
# hours per day
hoursPerDay: 8
# columns to include in the report
# available columns: id, iid, title,
columns:
- iid
- title
- estimation
# date format
dateFormat: Y-m-d H:i:s
# default output
output: markdown
# exclude issues and merge requests that have the following labels
excludeByLabels:
- wont-fix
- ignore
# only include issues and merge request that have the following labels
includeByLabels:
- critical
- important
# exclude the following labels in the results
excludeLabels:
- bug
- feature
# only include the following labels in the result
includeLabels:
- pending
- approved
There's no API for querying time results, so I have to fetch all the comments and parse them for time spent. That process takes quite a while (2 additional requests for each Issue). I'm sorry, blame GitLab for implementing it that way.
Yeah, I'm aware of that. For now (March 2017) GitLabs time tracking is a mess and this tool makes it way better.
Because I'm a PHP dev. And I like PHP. Actually PHP is not that bad. Shut up and get a life.
GPL v2