SmartRW/project-lvl2-s329

View on GitHub
src/bin/gendiff.js

Summary

Maintainability
A
0 mins
Test Coverage
#!/usr/bin/env node

import commander from 'commander';
import { description, version } from '../../package.json';
import genDiff from '..';

commander
  .version(`${version}`, '-V, --version')
  .description(`${description}`)
  .arguments('<firstConfig> <secondConfig>')
  .option('-f, --format [type]',
    `Output format:
    "tree" - shows diff as a tree;
    "plain" - shows diff as a list;
    "json" - shows diff as a JSON string`, 'tree')
  .action((firstConfig, secondConfig) => {
    console.log(genDiff(firstConfig, secondConfig, commander.format));
  })
  .parse(process.argv);