1313from fosslight_prechecker ._precheck import run_lint
1414
1515
16- def run_main (mode , path , output , format , no_log , disable , copyright , license ):
16+ def run_main (mode , path , output , format , no_log , disable , copyright , license , parser ):
17+ if mode != "add" and (copyright != "" or license != "" ):
18+ parser .print_help ()
19+ sys .exit (1 )
20+
1721 if mode == "lint" :
1822 run_lint (path , disable , output , format , no_log )
1923 elif mode == "add" :
@@ -34,8 +38,8 @@ def main():
3438 parser .add_argument ('-p' , '--path' , help = 'Path to check' , type = str , dest = 'path' , default = "" )
3539 parser .add_argument ('-f' , '--format' , help = 'Format of ouput' , type = str , dest = 'format' , default = "" )
3640 parser .add_argument ('-o' , '--output' , help = 'Output file name' , type = str , dest = 'output' , default = "" )
37- parser .add_argument ('-l' , '--license' , help = ' License name to add' , type = str , dest = 'license' , default = "" )
38- parser .add_argument ('-c' , '--copyright' , help = ' Copyright to add' , type = str , dest = 'copyright' , default = "" )
41+ parser .add_argument ('-l' , '--license' , help = " License name to add(used in only 'add' mode)" , type = str , dest = 'license' , default = "" )
42+ parser .add_argument ('-c' , '--copyright' , help = " Copyright to add(used in only 'add' mode)" , type = str , dest = 'copyright' , default = "" )
3943 parser .add_argument ('--notice' , action = 'store_true' , required = False )
4044 try :
4145 args = parser .parse_args ()
@@ -62,7 +66,7 @@ def main():
6266 print (f .read ())
6367 else :
6468 run_main (args .mode , args .path , args .output , args .format ,
65- args .log , args .disable , args .copyright , args .license )
69+ args .log , args .disable , args .copyright , args .license , parser )
6670
6771
6872if __name__ == "__main__" :
0 commit comments