Skip to content

Commit 3895b35

Browse files
committed
make help command more elegant in exiting
1 parent c0d90b3 commit 3895b35

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

mcoq.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ def check_args():
113113
try:
114114
args = parser.parse_args()
115115
except:
116-
print("ERROR: Missing required arguments. Please ensure you have passed correct arguments. List of required args shown above.")
116+
if not "-h" in sys.argv and not "--help" in sys.argv:
117+
print("ERROR: Missing required arguments. Please ensure you have passed correct arguments. List of required args shown above.")
117118
return False
118119

120+
119121
if args.mutator == "" and args.threads != "" and args.threads != "1":
120122
args.mutator = "MutatorOneFileVOParMutant"
121123

@@ -224,18 +226,17 @@ def main():
224226
if not args.skipmutations:
225227
if os.path.exists(OLD_REPORT_DIR+"/mcoq_log.txt"):
226228
os.system("rm -rf "+OLD_REPORT_DIR+"/mcoq_log.txt")
227-
228-
if not args.skipmutations:
229-
setup_repo()
230-
run_java(MCOQ_MODE)
231-
if not args.skipreport:
232-
gen_report(MCOQ_MODE)
233-
234-
if __name__ == '__main__':
235229
try:
236-
main()
230+
if not args.skipmutations:
231+
setup_repo()
232+
run_java(MCOQ_MODE)
233+
if not args.skipreport:
234+
gen_report(MCOQ_MODE)
237235
except:
238236
print("Error running mcoq script. Exiting now.")
237+
238+
if __name__ == '__main__':
239+
main()
239240

240241
# General examples for running mcoq.py
241242
# ./mcoq.py --project [PROJECT NAME] --sha [PROJECT SHA] --url [PROJECT URL] --buildcmd [PROJECT CMD] --qdir [PROJECT QDIR] --rdir [PROJECT RDIR]

0 commit comments

Comments
 (0)