Skip to content

Commit

Permalink
add Stock module
Browse files Browse the repository at this point in the history
  • Loading branch information
g-viet committed Apr 24, 2019
1 parent 0ef1dcd commit 60d67f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/usr/bin/env node

const program = require('commander');
import * as Stock from './stock';

program
.version('0.0.1')
.description("Stock CLI for getting stock information")
.arguments('get <stock> [otherStocks...]', 'get one or more stocks price')
.action((cmd: string, stocks?: string[]) => {
console.log("Instruction: %s", cmd);
if (stocks){
console.log("And other stocks: %s", stocks.join("-"));
.action((cmd: string, stocks: string[] = []) => {
switch(cmd) {
case "get":
Stock.get(stocks);
break;
default:
console.log(`No "${cmd}" method.`)
}
});

Expand Down
9 changes: 9 additions & 0 deletions src/stock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

const get = (args: string[]): void => {
console.log(`You want to fetch ${args}`);
return;
}

export {
get
}

0 comments on commit 60d67f5

Please sign in to comment.