Skip to content

Commit db0f564

Browse files
committed
Merge branch 'attiks-GTT-12'
2 parents 20abf15 + 9d735f9 commit db0f564

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:8.2.1-alpine
22

3-
ENV GTT_VERSION 1.5.5
3+
ENV GTT_VERSION 1.6.0
44

55
RUN yarn global add --prefix /usr/local "gitlab-time-tracker@$GTT_VERSION"
66

gtt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
const version = '1.5.5';
3+
const version = '1.6.0';
44
const program = require('commander');
55

66
program

include/file-config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,20 @@ class fileConfig extends config {
4545
*/
4646
parseLocal() {
4747
try {
48-
return yaml.sync(this.local, {});
48+
let local = Object.assign({extend: true}, yaml.sync(this.local, {}));
49+
50+
if (local.extend === true) {
51+
local = Object.assign(this.parseGlobal(), local);
52+
} else if (local.extend) {
53+
try {
54+
local = Object.assign(yaml.sync(local.extend, {}), local);
55+
} catch (e) {
56+
console.log(`Error parsing configuration: "${local.extend}"`);
57+
process.exit(1);
58+
}
59+
}
60+
61+
return local;
4962
} catch (e) {
5063
console.log(`Error parsing configuration: "${this.local}"`);
5164
process.exit(1);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitlab-time-tracker",
3-
"version": "1.5.5",
3+
"version": "1.6.0",
44
"description": "A command line interface for GitLabs time tracking feature.",
55
"bugs": {
66
"url": "https://github.com/kriskbx/gitlab-time-tracker/issues"

readme.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ gtt config
141141
gtt config --local
142142
```
143143

144-
If a local configuration file is present it's used instead of the global one.
145-
So you can use gtt on a per project basis. Make sure to add .gtt.yml to your
146-
gitignore file if using a local configuration.
144+
If a local configuration file is present it will extend of the global one and overwrites global settings.
145+
If you don't want to extend the global configuration file, set the `extend` option in your local config to `false`.
146+
So you can use gtt easily on a per project basis. Make sure to add .gtt.yml to your gitignore file if using a local configuration.
147147

148148
### II) time tracking
149149

@@ -576,6 +576,12 @@ _parallel: 20
576576
# Change rows per page (max. 100)
577577
# defaults to 100
578578
_perPage: 100
579+
580+
# Only works if using a local configuration file!
581+
# Extend the global configuration if set to true, pass a string to extend
582+
# the configuration file stored at the given path
583+
# defaults to true
584+
extend: true
579585
```
580586
581587
### Time format

upgrade.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# gtt
22

3+
### upgrading from < 1.5.* to 1.6.*
4+
5+
Starting with version `1.6` the local configuration file will extend the global configuration by default. If you
6+
don't want this behaviour, make sure to use `extend: false` in your local config.
7+
38
### upgrading from 0.*
49

510
I built gtt originally in PHP because I'm a PHP dev and I chose the language I'm most familiar

0 commit comments

Comments
 (0)