| 
									
										
										
										
											2025-01-21 21:17:56 +08:00
										 |  |  | module uahgi | 
					
						
							| 
									
										
										
										
											2025-01-25 02:23:13 +08:00
										 |  |  | include("parsing.jl") | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  | using .Parsing | 
					
						
							|  |  |  | using ArgParse | 
					
						
							| 
									
										
										
										
											2025-01-21 21:17:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  | function parse_commandline() | 
					
						
							|  |  |  |     #= please see:
 | 
					
						
							|  |  |  |     https://carlobaldassi.github.io/ArgParse.jl/stable/ | 
					
						
							|  |  |  |     =# | 
					
						
							|  |  |  |     s = ArgParseSettings() | 
					
						
							| 
									
										
										
										
											2025-01-21 21:17:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  |     @add_arg_table! s begin | 
					
						
							|  |  |  |         "FILE" | 
					
						
							|  |  |  |             help = "the file path to be converted." | 
					
						
							| 
									
										
										
										
											2025-01-25 11:18:37 +08:00
										 |  |  |             required = true | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return parse_args(s) | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function main() | 
					
						
							|  |  |  |     parsed_args = parse_commandline() | 
					
						
							| 
									
										
										
										
											2025-01-25 11:18:37 +08:00
										 |  |  |     file_path = parsed_args["FILE"] | 
					
						
							|  |  |  |     # for test | 
					
						
							|  |  |  |     #if parsed_args["FILE"] === nothing | 
					
						
							|  |  |  |     #    file_path = "./example/ex1.ug" | 
					
						
							|  |  |  |     #else | 
					
						
							|  |  |  |     #    file_path = parsed_args["FILE"] | 
					
						
							|  |  |  |     #end | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  |     file_content = open(f->read(f, String), file_path) | 
					
						
							|  |  |  |     Parsing.parse(file_content) | 
					
						
							| 
									
										
										
										
											2025-01-21 21:17:56 +08:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2025-01-21 23:46:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | main() | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 |