UNPKG

baki

Version:

A package for Tracking Due in shell

31 lines (23 loc) 858 B
#!/usr/bin/env node const fs = require('fs'); const Table = require('cli-table'); const chalk = require('chalk'); const formatData = require('./utils/formatData'); const colorMap = require('./utils/colorMap'); const addNew = require('./functions/addNew'); const history = require('./functions/history'); const getHelp = require('./functions/help'); const path = require('path'); const args = process.argv.slice(2); const packageUrl = path.resolve(__dirname,'./package.json'); if (args[0] === 'add' | args[0] === 'rm' | args[0] === 'remove' && !isNaN(args[1])) { addNew(args[1],args[0],args[2]); }else if(args[0] === 'history'){ history(); }else if (args[0] === 'help' | args[0] === '--help') { getHelp(); }else if (args[0] === '-v') { fs.readFile(packageUrl,'utf-8',(err,data)=>{ console.log(JSON.parse(data).version); }) }