diff --git a/cli/index.js b/cli/index.js index 104ab51..6df7180 100644 --- a/cli/index.js +++ b/cli/index.js @@ -10,6 +10,7 @@ const cfg = require('../app/data/cfg.json') const pkg = require('./package.json') const delay = require('delay') +const exit = require('exit') const intval = require('intval') const arduino = require('arduino')(cfg, ee) const Mscript = require('mscript') @@ -19,6 +20,7 @@ const dev = require('device') let log let readline +let devices async function command () { return new Promise ((resolve, reject) => { @@ -58,12 +60,18 @@ async function main (arg) { log.info('mcopy-cli') try { - await arduino.enumerate() + devices = await arduino.enumerate() } catch (err) { log.error('Error enumerating devices') log.error(err) } + if (!devices ||devices.length > 1) { + return exit('No devices found', 1) + } + + await dev.all(devices) + if (arg.pattern) { } @@ -82,6 +90,7 @@ program .option('-l, --live', 'Live control mode') .option('-f, --frames', 'Number of frames to capture with camera') .option('-p, --pattern', 'Pattern of sequence to be repeated') + .option('-i, --intval', 'URL of intval3') .option('-m, --mscript', 'Execute an mscript file') .option('-q, --quiet', 'Suppresses all log messages') .parse(process.argv)