@@ -145,14 +145,14 @@ def cli():
145
145
template_vars_group .add_argument ('--class-name' ,
146
146
dest = 'mclass_name' ,
147
147
type = str ,
148
- required = True ,
148
+ required = False ,
149
149
default = None ,
150
150
help = 'Specify the class name of your template code.' )
151
151
152
152
template_vars_group .add_argument ('--func-name' ,
153
153
dest = 'mfunc_name' ,
154
154
type = str ,
155
- required = True ,
155
+ required = False ,
156
156
default = None ,
157
157
help = 'Specify the entrypoint function to your code.' )
158
158
@@ -233,6 +233,23 @@ def cli():
233
233
234
234
sys .exit (1 )
235
235
236
+ if args .mclass_name is None :
237
+
238
+ print ()
239
+ print (f'[!] The --class-name flag must be used with all output modules.' )
240
+ print ()
241
+
242
+ sys .exit (1 )
243
+
244
+ if args .mfunc_name is None :
245
+
246
+ print ()
247
+ print (f'[!] The --func-name flag must be used with all output modules.' )
248
+ print ()
249
+
250
+ sys .exit (1 )
251
+
252
+
236
253
if args .mtype == 'decrypter' and args .validate_compatibility :
237
254
238
255
for m in args .mcompatible_imodules :
@@ -364,26 +381,28 @@ def cli():
364
381
sys .exit (1 )
365
382
366
383
# ensure input files actually exist and are not directories
384
+
385
+ if args .mtype in OMODULE_TYPES :
367
386
368
- if not os .path .exists (args .source_file ):
387
+ if not os .path .exists (args .source_file ):
369
388
370
- print (f'[!] Error: source file { args .source_file } does not exist' )
371
- sys .exit (1 )
389
+ print (f'[!] Error: source file { args .source_file } does not exist' )
390
+ sys .exit (1 )
372
391
373
- if not os .path .isfile (args .source_file ):
392
+ if not os .path .isfile (args .source_file ):
374
393
375
- print (f'[!] Error: source file { args .source_file } is a directory' )
376
- sys .exit (1 )
394
+ print (f'[!] Error: source file { args .source_file } is a directory' )
395
+ sys .exit (1 )
377
396
378
- if not os .path .exists (args .symbol_file ):
397
+ if not os .path .exists (args .symbol_file ):
379
398
380
- print (f'[!] Error: symbol file { args .symbol_file } does not exist' )
381
- sys .exit (1 )
399
+ print (f'[!] Error: symbol file { args .symbol_file } does not exist' )
400
+ sys .exit (1 )
382
401
383
- if not os .path .isfile (args .symbol_file ):
402
+ if not os .path .isfile (args .symbol_file ):
384
403
385
- print (f'[!] Error: symbol file { args .symbol_file } is a directory' )
386
- sys .exit (1 )
404
+ print (f'[!] Error: symbol file { args .symbol_file } is a directory' )
405
+ sys .exit (1 )
387
406
388
407
return args
389
408
@@ -562,6 +581,8 @@ def create(args):
562
581
with open (output_py_template_path , 'w' ) as output_handle :
563
582
output_handle .write (rendered_template + '\n ' )
564
583
584
+ print (f'[*] Saved new module to path: { output_py_template_path } ' )
585
+
565
586
if source_file is not None :
566
587
567
588
with open (source_file ) as input_handle :
@@ -579,6 +600,9 @@ def create(args):
579
600
with open (output_file , 'w' ) as output_handle :
580
601
output_handle .write (raw_output )
581
602
603
+ print (f'[*] Saved new template to path: { output_file } ' )
604
+
605
+
582
606
else :
583
607
584
608
module_direction = 'input'
@@ -601,10 +625,13 @@ def create(args):
601
625
description = mdescription ,
602
626
compatible_interfaces = compatible_interfaces ,
603
627
compatible_xmodules = compatible_xmodules )
604
-
628
+
605
629
with open (output_py_template_path , 'w' ) as output_handle :
606
630
output_handle .write (rendered_template + '\n ' )
607
631
632
+ print (f'[*] Saved new module to path: { output_py_template_path } ' )
633
+
634
+
608
635
def main ():
609
636
610
637
args = cli ()
0 commit comments