-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold_main.py
More file actions
57 lines (47 loc) · 1.58 KB
/
old_main.py
File metadata and controls
57 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
Main script for Word Specifications Parser
This script allows running either:
1. The command-line parser directly
2. The GUI-based converter application
Usage:
python main.py [--gui]
Options:
--gui Launch the GUI converter application (default)
--cli Run the command-line parser
"""
import os
import sys
import argparse
def run_gui():
"""Run the GUI converter application."""
try:
from converter_app import main as converter_main
converter_main()
except ImportError:
print("Error: converter_app.py not found or has errors.")
print("Make sure converter_app.py is in the same directory.")
sys.exit(1)
def run_cli():
"""Run the command-line parser."""
try:
from word_parser import main as parser_main
parser_main()
except ImportError:
print("Error: word_parser.py not found or has errors.")
print("Make sure word_parser.py is in the same directory.")
sys.exit(1)
def main():
"""Main function to parse arguments and run the appropriate module."""
parser = argparse.ArgumentParser(description="Word Specifications Parser")
group = parser.add_mutually_exclusive_group()
group.add_argument("--gui", action="store_true", help="Launch the GUI converter application (default)")
group.add_argument("--cli", action="store_true", help="Run the command-line parser")
args = parser.parse_args()
# Default to GUI if no arguments provided
if not args.cli:
run_gui()
else:
run_cli()
if __name__ == "__main__":
main()