-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
37 lines (36 loc) · 1.19 KB
/
config.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
29
30
31
32
33
34
35
36
37
const path = require('path');
const config = require('yargs')
.usage('Usage: $0 [options]')
.describe('v', 'possible values: "error", "warn", "info", "debug"')
.describe('s', 'scan for dash buttons')
.describe('m', 'json file containing dashbutton-mqtt mappings (see Readme)')
.describe('n', 'instance name. used as mqtt client id and as prefix for connection topic')
.describe('u', 'mqtt broker url. See https://github.com/mqttjs/MQTT.js#connect-using-a-url')
.describe('i', 'bind to network interface to listen for dash button presses')
.describe('p', 'protocol to use for button detection. possible values: "arp", "udp", "all"')
.describe('t', 'timeout between button presses.')
.describe('h', 'show help')
.alias({
h: 'help',
n: 'name',
m: 'mapping',
u: 'url',
s: 'scan',
v: 'verbosity',
i: 'interface',
t: 'timeout',
p: 'protocol'
})
.default({
u: 'mqtt://127.0.0.1',
n: 'dashbutton',
v: 'info',
m: path.join(__dirname, '/example.json'),
i: null,
t: 5000,
p: 'all'
})
.help()
.version()
.argv;
module.exports = config;