simpler CLI
This commit is contained in:
		
							
								
								
									
										8
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								app.js
									
									
									
									
									
								
							| @ -11,20 +11,18 @@ const exec_name = args[0].split('/').pop(); | |||||||
| const server_port = args[1]; | const server_port = args[1]; | ||||||
| const clients_list = args.slice(2); | const clients_list = args.slice(2); | ||||||
|  |  | ||||||
| if(server_port){ | if(server_port === "help"){ | ||||||
| 	console.log('port:', server_port, 'clients:', clients_list) |  | ||||||
|  |  | ||||||
| }else{ |  | ||||||
| 	console.error('Please supply the server port and list of clients to connect too;') | 	console.error('Please supply the server port and list of clients to connect too;') | ||||||
| 	console.error(`${exec_name} <server port> <client 1> <client 2> <client 3> ...` ) | 	console.error(`${exec_name} <server port> <client 1> <client 2> <client 3> ...` ) | ||||||
| 	console.error(`${exec_name} 7575 10.1.0.1:7575 10.2.0.1:7575 10.3.0.1:7575` ) | 	console.error(`${exec_name} 7575 10.1.0.1:7575 10.2.0.1:7575 10.3.0.1:7575` ) | ||||||
| 	process.exit(0) | 	process.exit(0) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | console.log('port:', server_port, 'clients:', clients_list) | ||||||
|  |  | ||||||
| app.p2p = new P2P({ | app.p2p = new P2P({ | ||||||
| 	listenPort: server_port, | 	listenPort: server_port, | ||||||
| 	peers: clients_list | 	peers: clients_list | ||||||
| }) | }) | ||||||
|  |  | ||||||
| app.pubsub = require('./pubsub') | app.pubsub = require('./pubsub') | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
|   "name": "vpn-p2p", |   "name": "vpn-p2p", | ||||||
|   "version": "1.0.0", |   "version": "1.0.0", | ||||||
|   "description": "", |   "description": "", | ||||||
|   "main": "index.js", |   "main": "app.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "test": "echo \"Error: no test specified\" && exit 1" |     "test": "echo \"Error: no test specified\" && exit 1" | ||||||
|   }, |   }, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user