tty-table
Version:
Command line table generator.
27 lines (25 loc) • 1.12 kB
JavaScript
//yargs help descriptions
let yargs = require('yargs');
yargs.option('csv-*',{
describe:'Set a custom option for node-csv-parse. \nYou can see a complete list of options at http://csv.adaltas.com/parse/.'
});
yargs.option('header-n-*',{
describe:'Set a custom option for a header column where "n" is the order of the column and "*" is the name of the option.'
});
yargs.option('format',{
describe:'Set input data format',
choices:['json','csv'],
default:'csv'
});
yargs.example('cat somefile.json | tty-table --format=json','Send JSON file to tty-table.');
yargs.example('',''); //just for a blank line
yargs.example('echo "ticker","price"$\'\\n\'"AAPL",200 | tty-table --header-0-color="red" --csv-rowDelimiter=$\'\\n\'','Send inline CSV to tty-table. Set the text of all rows in column 0 to red, set the csv row delimiter to \\n.');
yargs.version(function(){
let fs = require('fs');
let path =__dirname+'/../package.json';
let contents = fs.readFileSync(path,'utf-8');
let json = JSON.parse(contents);
return json.version;
});
yargs.epilog('Copyight github.com/tecfu 2017');
module.exports = yargs;