feat: Add file existence check before processing input filename
This commit is contained in:
parent
a95a67f834
commit
ccd860e4d9
8
gtm
8
gtm
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import curses
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
@ -239,7 +240,14 @@ if __name__ == "__main__":
|
|||
elif sys.argv[1] == "-h" or sys.argv[1] == "--help":
|
||||
show_help()
|
||||
sys.exit(0)
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
# Check if the file exists
|
||||
if not os.path.isfile(filename):
|
||||
print(f"Error: File '{filename}' does not exist")
|
||||
sys.exit(1)
|
||||
|
||||
curses.wrapper(main, filename)
|
||||
else:
|
||||
show_help()
|
||||
|
|
|
|||
Loading…
Reference in New Issue