matcha-stock
Version:
A simple CLI command to get stocks information from Yahoo Finance
27 lines (26 loc) • 1.04 kB
JavaScript
;
const command_1 = require("@oclif/command");
const getStocks_1 = require("./getStocks");
class MatchaStock extends command_1.Command {
async run() {
const { flags } = this.parse(MatchaStock);
const res = await getStocks_1.getSingleStockInfo(flags.symbol);
// Print the result as tabular
console.table(res);
}
}
MatchaStock.description = `A simple command to retrieve stock information from Yahoo Finance.\nA simple command to retrieve stock information from Yahoo Finance.\n\n Created with ❤️ by Elitizon (https://www.elitizon.com)`;
MatchaStock.flags = {
// add --version flag to show CLI version
version: command_1.flags.version({ char: 'v' }),
help: command_1.flags.help({ char: 'h' }),
// Add Support of of -symbol flag
// flag with a value (-s, --symbol=VALUE)
symbol: command_1.flags.string({
char: 's',
description: 'stock symbol to retrieve',
required: true,
helpValue: 'MSFT',
}),
};
module.exports = MatchaStock;