File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ const config = require('./config');
44const yaml = require('read-yaml');
55const hash = require('hash-sum');
66const Fs = require('./filesystem');
7- const extend = require('util')._extend;
87
98/**
109 * file config with local and global configuration files
@@ -46,9 +45,20 @@ class fileConfig extends config {
4645 */
4746 parseLocal() {
4847 try {
49- let global = this.parseGlobal();
50- let local = yaml.sync(this.local, {});
51- return extend(global, 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;
5262 } catch (e) {
5363 console.log(`Error parsing configuration: "${this.local}"`);
5464 process.exit(1);
Original file line number Diff line number Diff line change @@ -141,9 +141,9 @@ gtt config
141141gtt 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
You can’t perform that action at this time.
0 commit comments