blinky/libs/cli.js

24 lines
732 B
JavaScript
Raw Normal View History

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