Make bin/xenu-nntp-server includeable
This commit is contained in:
		
							parent
							
								
									a13002b9f0
								
							
						
					
					
						commit
						93f89bc7d6
					
				
					 1 changed files with 16 additions and 12 deletions
				
			
		| 
						 | 
					@ -7,6 +7,7 @@ from xenu_nntp.config import Config
 | 
				
			||||||
from xenu_nntp.server import Server
 | 
					from xenu_nntp.server import Server
 | 
				
			||||||
from xenu_nntp.daemon import Daemon
 | 
					from xenu_nntp.daemon import Daemon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main():
 | 
				
			||||||
    parser = argparse.ArgumentParser(description='Tiny NNTP server')
 | 
					    parser = argparse.ArgumentParser(description='Tiny NNTP server')
 | 
				
			||||||
    parser.add_argument('--daemon',      '-d', action='store_true', help='Run NNTP server as daemon in background')
 | 
					    parser.add_argument('--daemon',      '-d', action='store_true', help='Run NNTP server as daemon in background')
 | 
				
			||||||
    parser.add_argument('--config-file', '-f', type=str,            help='Specify a configuration file location')
 | 
					    parser.add_argument('--config-file', '-f', type=str,            help='Specify a configuration file location')
 | 
				
			||||||
| 
						 | 
					@ -23,3 +24,6 @@ try:
 | 
				
			||||||
        server.run()
 | 
					        server.run()
 | 
				
			||||||
    except KeyboardInterrupt:
 | 
					    except KeyboardInterrupt:
 | 
				
			||||||
        server.stop()
 | 
					        server.stop()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					    exit(main())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue