All files / bin cli.js

0% Statements 0/14
0% Branches 0/2
0% Functions 0/1
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 38 39 40 41 42 43 44 45 46                                                                                           
#! /usr/bin/env node
 
const program = require('commander');
const version = require('../package.json').version;
const Interchange = require('../lib/interchange');
const Inquire = require('../lib/inquire');
const interchange = new Interchange();
 
program
  .version(version);
 
program.command('list')
  .description('Lists all of the available firmwares')
  .alias('l')
  .action(interchange.list_devices.bind(interchange));
 
program.command('ports')
  .description('Lists all of the attached boards and their ports')
  .alias('p')
  .option('-v, --verbose', 'List with additional information')
  .action(interchange.list_ports.bind(interchange));
 
program.command('read')
  .description('Read firmware info from port')
  .alias('r')
  .option('-p, --port', 'Serial port board is attached to')
  .action(interchange.get_firmware_info.bind(interchange));
 
program.command('install [firmware]')
  .description('Install specified firmware to board')
  .alias('i')
  .option('-a, --board <board>', 'Type of board/AVR')
  .option('-p, --port <port>', 'Serial port board is attached to')
  .option('-f, --firmata [firmata]', 'Install firmata version of firmware')
  .option('-i, --address <address>', 'Specify I2C address, eg 0x67')
  .option('--interactive', 'Interactive mode will prompt for input')
  .action(function(firmware, opts) {
    if (opts.interactive) {
      const inquire = new Inquire(interchange.install_firmware.bind(interchange));
    } else {
      interchange.install_firmware(firmware, opts);
    }
  });
 
program.parse(process.argv);