@@ -318,10 +318,10 @@ def complete(message_func, elf0, hexf0, hexf1=None):
318
318
319
319
def merge_action (args ):
320
320
"""Entry point for the "merge" CLI command."""
321
- try :
322
- elf_file = list ( pathlib . Path (args .artefacts_location ). glob ( "*.elf" ))[ 0 ]
323
- m4hex_file = list ( pathlib . Path ( args . artefacts_location ). glob ( "*.hex" ))[ 0 ]
324
- except IndexError :
321
+ elf_file = os . path . join ( args . artefacts_location , args . application_name + ".elf" )
322
+ m4hex_file = os . path . join (args .artefacts_location , args . application_name + ".hex" )
323
+
324
+ if not os . path . isfile ( elf_file ) or not os . path . isfile ( m4hex_file ) :
325
325
raise ArtefactsError (
326
326
f"Could not find elf and/or hex file in { args .artefacts_location } "
327
327
)
@@ -333,10 +333,9 @@ def merge_action(args):
333
333
334
334
def sign_action (args ):
335
335
"""Entry point for the "sign" CLI command."""
336
- try :
337
- elf_file = list (pathlib .Path (args .artefacts_location ).glob ("*.elf" ))[0 ]
338
- m4hex_file = list (pathlib .Path (args .artefacts_location ).glob ("*.hex" ))[0 ]
339
- except IndexError :
336
+ elf_file = os .path .join (args .artefacts_location , args .application_name + ".elf" )
337
+ m4hex_file = os .path .join (args .artefacts_location , args .application_name + ".hex" )
338
+ if not os .path .isfile (elf_file ) or not os .path .isfile (m4hex_file ):
340
339
raise ArtefactsError (
341
340
f"Could not find elf and/or hex file in { args .artefacts_location } "
342
341
)
@@ -370,6 +369,9 @@ def parse_args():
370
369
merge_subcommand .add_argument (
371
370
"--artefacts-location" , required = True , help = "the path to the application artefacts."
372
371
)
372
+ merge_subcommand .add_argument (
373
+ "--application-name" , required = True , help = "Name of the application."
374
+ )
373
375
merge_subcommand .add_argument (
374
376
"--m0hex" , help = "the path to the Cortex-M0 HEX to merge."
375
377
)
@@ -402,6 +404,9 @@ def parse_args():
402
404
sign_subcommand .add_argument (
403
405
"--artefacts-location" , required = True , help = "the path to the application artefacts."
404
406
)
407
+ sign_subcommand .add_argument (
408
+ "--application-name" , required = True , help = "Name of the application."
409
+ )
405
410
sign_subcommand .add_argument (
406
411
"--m0hex" , help = "the path to the Cortex-M0 HEX to merge."
407
412
)
0 commit comments