simpler CLI

This commit is contained in:
William Mantly 2020-08-21 17:03:55 -04:00
parent 164a972faa
commit 37e724cd76
Signed by: wmantly
GPG Key ID: 186A8370EFF937CA
2 changed files with 4 additions and 6 deletions

6
app.js
View File

@ -11,16 +11,14 @@ 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,

View File

@ -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"
}, },