@@ -121,7 +121,7 @@ def build_args():
121
121
parser .add_argument ('--web-push-slug' , type = str , default = None , help = "Override the source slug given in the analysisgroup and force it to be this" )
122
122
parser .add_argument ('--token' , type = str , default = None , help = "Token for authentication to iotile cloud (instead of a password)" )
123
123
parser .add_argument ('-d' , '--domain' , default = DOMAIN_NAME , help = "Domain to use for remote queries, defaults to https://iotile.cloud" )
124
- parser .add_argument ('analysis_group' , default = None , nargs = '? ' , help = "The slug or path of the object you want to perform analysis on" )
124
+ parser .add_argument ('analysis_group' , default = None , nargs = '+ ' , help = "The slug or path of the object you want to perform analysis on" )
125
125
126
126
return parser
127
127
@@ -214,6 +214,21 @@ def print_report_details(report):
214
214
except ValidationError :
215
215
print ("Error parsing docstring for report." )
216
216
217
+ def find_analysis_groups (args ):
218
+ """Parse through the list of options for analysis_group and build a list"""
219
+ all_groups = []
220
+ all_logins = True
221
+
222
+ groups = args .analysis_group
223
+ for _group in groups :
224
+ logged_in , group = find_analysis_group (_group )
225
+ all_groups .append (group )
226
+ all_logins = all_logins and logged_in
227
+
228
+ if len (all_groups ) == 1 :
229
+ return all_logins , all_groups [0 ]
230
+
231
+ return all_logins , all_groups
217
232
218
233
def find_analysis_group (args ):
219
234
"""Find an analysis group by name."""
@@ -337,6 +352,11 @@ def build_file_handler(output_path, standalone, bundle, web_push, label, group,
337
352
if label is None :
338
353
label = input ("Enter a label for the report: " )
339
354
355
+
356
+ # if there are multiple AnalysisGroup, push to the first one by default
357
+ if isinstance (group , list ):
358
+ group = group [0 ]
359
+
340
360
if slug is None and group is not None :
341
361
slug = group .source_info .get ('slug' )
342
362
@@ -422,7 +442,7 @@ def main(argv=None):
422
442
return 0
423
443
424
444
report_args = split_args (args .arg )
425
- logged_in , group = find_analysis_group (args )
445
+ logged_in , group = find_analysis_groups (args )
426
446
427
447
428
448
check_arguments (report_obj , report_args , confirm = not args .no_confirm )
0 commit comments