UNPKG

tenzetta

Version:

Terminal-based stock market viewer with real-time data streaming

59 lines (49 loc) 1.58 kB
#!/usr/bin/env node const { program } = require('commander'); const chalk = require('chalk'); const boxen = require('boxen'); const path = require('path'); // ASCII Logo const showLogo = () => { const logo = chalk.cyan.bold(`╔╦╗╔═╗╔╗╔╔═╗╔═╗╔╦╗╔╦╗╔═╗ ║ ║╣ ║║║╔═╝║╣ ║ ║ ╠═╣ ╩ ╚═╝╝╚╝╚═╝╚═╝ ╩ ╩ ╩ ╩`) + chalk.gray(' 📈 Terminal Stock Data'); console.log(logo); console.log(chalk.gray('─'.repeat(35))); } program .name('tenzetta') .description('Terminal stock market data') .version('2.3.0'); program .command('stream [symbols...]') .description('Stream live quotes') .action((symbols, options) => { require('../lib/stream').run(symbols, options); }); program .command('market') .description('Market overview') .action((options) => { require('../lib/unified').run(options); }); program .command('quote <symbol>') .description('Get stock quote') .action((symbol) => { const unifiedOptions = { startSymbol: symbol, startView: 'quote-overview' }; require('../lib/unified').run(unifiedOptions); }); program .command('chart <symbol>') .description('Show price chart') .action((symbol, options) => { require('../lib/chart').run(symbol, { period: '1m', height: '15' }); }); // Show custom help if no command provided - then run unified interface if (!process.argv.slice(2).length) { // Run unified interface directly require('../lib/unified').run({}); return; } program.parse(process.argv);