blinky/libs/cli.js

24 lines
No EOL
732 B
JavaScript

const logger = require('./logger.js');
const controller = require('./controller.js');
const constants = require('./constants.js');
async function handleArguments() {
let handled = 0;
for (let index = 0; index < process.argv.length; index++) {
switch (process.argv[index]) {
case constants.ARG_CONFIG:
case constants.ARG_CONFIG_SHORT:
continue;
case constants.ARG_LIST:
case constants.ARG_LIST_SHORT:
logger.info('blinksticks: ' + JSON.stringify(await controller.getBlinkstick(constants.ALL, false)));
handled++;
break;
}
}
return handled > 0;
}
module.exports = {
handleArguments
};