Error if -t is specified multiple times.
authorCarl Hetherington <cth@carlh.net>
Wed, 11 Dec 2019 13:07:31 +0000 (14:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 11 Dec 2019 13:07:31 +0000 (14:07 +0100)
cdist

diff --git a/cdist b/cdist
index 8a1b3c42d676fc767f6ed74ed844263cff0330e7..e5af8f53e595d2084418454140f97e2e78db52cc 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -1014,7 +1014,7 @@ def main():
     parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
     parser.add_argument('-o', '--output', help='output directory', default='.')
     parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
-    parser.add_argument('-t', '--target', help='target')
+    parser.add_argument('-t', '--target', help='target', action='append')
     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')
@@ -1028,6 +1028,14 @@ def main():
     parser.add_argument('--ccache', help='use ccache', action='store_true')
     args = parser.parse_args()
 
+    # Check for incorrect multiple parameters
+    if args.target is not None:
+        if len(args.target) > 1:
+            parser.error('multiple -t options specified')
+            sys.exit(1)
+        else:
+            args.target = args.target[0]
+
     # Override configured stuff
     if args.git_prefix is not None:
         config.set('git_prefix', args.git_prefix)