How to use the homebridge-lib.CommandLineTool function in homebridge-lib

To help you get started, we’ve selected a few homebridge-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ebaauw / homebridge-hue / cli / ph.js View on Github external
${b('-v')}          Verbose.
  ${b('-t')} ${u('timeout')}  Timeout after ${u('timeout')} minutes (default: 5).
  ${u('light')}       Light resource to probe.`,
  restart: `${}

Usage: ${b('ph')} ${usage.restart}

Note: this command is not supported on a Hue bridge.

  ${b('-h')}          Print this help and exit.
  ${b('-v')}          Verbose.`

class Main extends homebridgeLib.CommandLineTool {
  constructor () {
    super({ mode: 'command', debug: false })
    this.usage =
    try {
    } catch (err) {
      if (err.code !== 'ENOENT') {
      this.bridges = {}

  // ===========================================================================

  _readBridges () {
github ebaauw / homebridge-hue / cli / dc_eventlog.js View on Github external
const usage = `${b('dc_eventlog')} [${b('-hVnrs')}] [${b('--host=')}${u('hostname')}[${b(':')}${u('port')}]]`
const help = `Logger for deCONZ websocket notifications.

Usage: ${usage}

Log deCONZ websocket notifications to stdout.
  ${b('-h')}          Print this help and exit.
  ${b('-V')}          Print version and exit.
  ${b('-n')}          Do not retry when websocket connection is closed.
  ${b('-r')}          Do not parse events, output raw event data.
  ${b('-s')}          Do not output timestamps (useful when running as service).
  ${b('-H')} ${u('hostname')}[${b(':')}${u('port')}]
              Connect to ${u('hostname')}${b(':')}${u('port')} instead of the default ${b('localhost:443')}.`

class Main extends homebridgeLib.CommandLineTool {
  constructor () {
    this.usage = usage
    this.options = {
      mode: 'daemon'
    } = {}

  parseArguments () {
    const parser = new homebridgeLib.CommandLineParser(packageJson)'h', 'help', help)
    parser.version('V', 'version')
    parser.option('H', 'host', (value) => {
      homebridgeLib.OptionParser.toHost('host', value, true) = value