feat: Add file existence check before processing input filename

This commit is contained in:
n loewen (aider) 2025-06-07 19:14:08 +01:00
parent a95a67f834
commit ccd860e4d9
1 changed files with 8 additions and 0 deletions

8
gtm
View File

@ -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()