Skip to content

Commit

Permalink
feat(projects): adds format option
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia committed Nov 8, 2018
1 parent 831be4b commit 85d4e81
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions source/mite-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ const program = require('commander');
const miteApi = require('mite-api');
const chalk = require('chalk');
const async = require('async');
const tableLib = require('table')
const table = tableLib.table;

const DataOutput = require('./lib/data-output');
const pkg = require('./../package.json');
const config = require('./config.js');
const formater = require('./lib/formater');
Expand Down Expand Up @@ -71,6 +70,11 @@ program
}),
false // default archive argument
)
.option(
'-f, --format <format>',
'defines the output format, valid options are ' + DataOutput.FORMATS.join(', '),
'table',
)
.parse(process.argv);

const opts = {
Expand Down Expand Up @@ -162,24 +166,21 @@ async.parallel([
'rate',
'note',
].map((v) => chalk.bold(v)));
const tableConfig = {
border: tableLib.getBorderCharacters('norc'),
columns: {
1: {
wrapWord: true,
},
3: {
alignment: 'right',
},
4: {
alignment: 'right',
},
5: {
width: 50,
wrapWord: true,
}
const columns = {
1: {
wrapWord: true,
},
3: {
alignment: 'right',
},
4: {
alignment: 'right',
},
5: {
width: 50,
wrapWord: true,
}
};

console.log(table(tableData, tableConfig));
console.log(DataOutput.formatData(tableData, program.format, columns));
});

0 comments on commit 85d4e81

Please sign in to comment.