Allow override of configured git_prefix.
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Jun 2015 20:57:33 +0000 (21:57 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Jun 2015 20:57:33 +0000 (21:57 +0100)
cdist

diff --git a/cdist b/cdist
index 300f308f417e1fbb06e5a498548921c576f78106..4d275ff5f97c48bdab0592328223046e20dd8384 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -124,6 +124,10 @@ class Config:
 
         raise Error('Required setting %s not found' % k)
 
+    def set(self, k, v):
+        for o in self.options:
+            o.offer(k, v)
+                
 config = Config()
 
 #
@@ -668,8 +672,13 @@ def main():
     parser.add_argument('-k', '--keep', help='keep working tree', action='store_true')
     parser.add_argument('--debug', help='build with debugging symbols where possible', action='store_true')
     parser.add_argument('-w', '--work', help='override default work directory')
+    parser.add_argument('-g', '--git-prefix', help='override configured git prefix')
     args = parser.parse_args()
 
+    # Override configured stuff
+    if args.git_prefix is not None:
+        config.set('git_prefix', args.git_prefix)
+
     if args.output.find(':') == -1:
         # This isn't of the form host:path so make it absolute
         args.output = os.path.abspath(args.output) + '/'