-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin.js
28 lines (26 loc) · 803 Bytes
/
bin.js
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
let argv = require('yargs')
.usage('Usage: ws -u echo.websocket.org -m test')
// .command('count', 'Count the lines in a file')
.example('ws -u echo.websocket.org -m test', '')
.alias('u', 'url')
.nargs('u', 1)
.describe('u', 'socket URL')
.alias('p', 'port')
.nargs('p', 1)
.describe('p', 'socket port')
.alias('m', 'message')
.describe('m', 'initial message')
.nargs('m', 1)
.alias('s', 'secured')
.describe('s', 'wss protocol')
.nargs('s', 1)
.demandOption(['u'])
.help('h')
.alias('h', 'help')
.epilog('copyright 2020')
.argv;
let socketURL = argv.url;
let socketPort = argv.port || null;
let socketMessage = argv.message || null;
let ssl = argv.ssl || false;
require(".")(socketURL, socketPort, socketMessage, ssl);