|
| 1 | +# gitlab-time-tracker |
| 2 | + |
| 3 | +> A command line interface that makes working with GitLabs time tracking feature more enjoyable. |
| 4 | +
|
| 5 | +### requirements |
| 6 | + |
| 7 | +* **php >= 7.0** (5.6 won't work) |
| 8 | + |
| 9 | +### installation |
| 10 | + |
| 11 | +#### using composer |
| 12 | + |
| 13 | +Make sure composer is [installed globally](https://getcomposer.org/doc/00-intro.md#globally) and `~/.composer/vendor/bin` is in your [PATH](http://subinsb.com/install-run-composer-binaries-globally). Then simply run: |
| 14 | + |
| 15 | +``` |
| 16 | +composer global require kriskbx/gitlab-time-tracker |
| 17 | +``` |
| 18 | + |
| 19 | +#### using docker |
| 20 | + |
| 21 | +> coming soon |
| 22 | +
|
| 23 | +### commands |
| 24 | + |
| 25 | +#### login |
| 26 | + |
| 27 | +Login to gitlab.com or your own GitLab instance using a private token. |
| 28 | + |
| 29 | +``` |
| 30 | +gtt login |
| 31 | +``` |
| 32 | + |
| 33 | +#### edit configuration |
| 34 | + |
| 35 | +Edit the global configuration file. [Available options](#options) |
| 36 | + |
| 37 | +``` |
| 38 | +gtt edit |
| 39 | +``` |
| 40 | + |
| 41 | +#### reports |
| 42 | + |
| 43 | +Get a report for your project or issue. |
| 44 | + |
| 45 | +``` |
| 46 | +# available report commands |
| 47 | +gtt report ["namespace/project"] [issue_id] |
| 48 | +gtt report:month ["2017-03"] ["namespace/project"] |
| 49 | +gtt report:day ["2017-03-01"] ["namespace/project"] |
| 50 | +
|
| 51 | +# include closed issues |
| 52 | +gtt report --closed=true |
| 53 | +
|
| 54 | +# limit to a user |
| 55 | +gtt report --user=username |
| 56 | +
|
| 57 | +# limit to a milestone |
| 58 | +gtt report --milestone=milestone_name |
| 59 | +
|
| 60 | +# overwrite the default date format or the date format stored in your config |
| 61 | +gtt report --date_format="d.m.Y H:i:s" |
| 62 | +
|
| 63 | +# overwrite the default columns or the columns stored in your config |
| 64 | +gtt report --columns=iid --columns=title --columns=estimation |
| 65 | +
|
| 66 | +# only include the given labels in the results, overwrites the includeLabels stored in your config file |
| 67 | +gtt report --include_labels=pending --include_labels=approved |
| 68 | +
|
| 69 | +# exclude the given labels from the results, overwrites the excludeLabels stored in your config file |
| 70 | +gtt report --exclude_labels=bug --exclude_labels=feature |
| 71 | +
|
| 72 | +# choose a different output than a stdout table (csv & json coming soon) |
| 73 | +gtt report --output=markdown --file=filename.md |
| 74 | +``` |
| 75 | + |
| 76 | +#### time tracking |
| 77 | + |
| 78 | +> coming soon |
| 79 | +
|
| 80 | +### configuration options |
| 81 | + |
| 82 | +Here's a sample configuration file including all available options: |
| 83 | + |
| 84 | +``` |
| 85 | +# url to the gitlab api. make sure there's a trailing slash |
| 86 | +url: http://gitlab.com/api/v4/ |
| 87 | +
|
| 88 | +# your api token |
| 89 | +token: abcdefghijklmnopqrst |
| 90 | +
|
| 91 | +# default project |
| 92 | +project: namespace/projectname |
| 93 | +
|
| 94 | +# include closed by default |
| 95 | +closed: true |
| 96 | +
|
| 97 | +# default milestone |
| 98 | +milestone: milestone_name |
| 99 | +
|
| 100 | +# hours per day |
| 101 | +hoursPerDay: 8 |
| 102 | +
|
| 103 | +# columns |
| 104 | +columns: |
| 105 | +- iid |
| 106 | +- title |
| 107 | +- estimation |
| 108 | +
|
| 109 | +# date format |
| 110 | +dateFormat: Y-m-d H:i:s |
| 111 | +
|
| 112 | +# default output |
| 113 | +output: markdown |
| 114 | +
|
| 115 | +# exclude the following labels in the results |
| 116 | +excludeLabels: |
| 117 | +- bug |
| 118 | +- feature |
| 119 | +
|
| 120 | +# only include the following labels in the result |
| 121 | +includeLabels: |
| 122 | +- pending |
| 123 | +- approved |
| 124 | +``` |
| 125 | + |
| 126 | +### faqs |
| 127 | + |
| 128 | +#### It takes a long time to get Issues and process them |
| 129 | + |
| 130 | +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. |
| 131 | + |
| 132 | +#### GitLab will probably ship some of these features sooner or later |
| 133 | + |
| 134 | +Yeah, I'm aware of that. For now (March 2017) GitLabs time tracking is a mess and this tool makes it way better. |
| 135 | + |
| 136 | +#### why php? why not ruby/node/go/python/erlang? |
| 137 | + |
| 138 | +Because I'm a PHP dev. And I like PHP. Actually PHP is not that bad. Shut up and get a life. |
| 139 | + |
| 140 | +### license |
| 141 | + |
| 142 | +GPL v2 |
0 commit comments