Skip to content

Commit 60fe625

Browse files
authored
chore: update commander options and circle ci badge(#340)
* chore: update commander options * chore: badge circle ci
1 parent 995151b commit 60fe625

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<h1 align="center">table-printer-cli</h1>
22
<h3 align="center">📟🍭Printing Pretty Tables on your terminal</h3>
33
<p align="center">
4-
<a href="https://travis-ci.com/ayonious/table-printer-cli">
5-
<img alt="Build Status" src="https://travis-ci.com/ayonious/table-printer-cli.svg?branch=master">
6-
</a>
4+
<a href="https://dl.circleci.com/status-badge/redirect/gh/ayonious/table-printer-cli/tree/master"><img src="https://dl.circleci.com/status-badge/img/gh/ayonious/table-printer-cli/tree/master.svg?style=svg"></a>
75
<a href="https://codecov.io/gh/ayonious/table-printer-cli">
86
<img alt="codecov" src="https://codecov.io/gh/ayonious/table-printer-cli/branch/master/graph/badge.svg">
97
</a>

index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
#!/usr/bin/env node
2-
import { program } from 'commander';
2+
import { Command } from 'commander';
33
import * as fs from 'fs';
44

55
import printTableFromInp from './src/service';
66

7+
const program = new Command();
8+
79
program
810
.option('-i, --input <value>', 'input string')
911
.option('-s, --stdin', 'read input from stdin')
1012
.parse(process.argv);
1113

12-
if (program.input) {
13-
console.log('program.input', program.input);
14-
printTableFromInp(program.input);
15-
} else if (program.stdin) {
14+
const options = program.opts();
15+
16+
if (options.input) {
17+
console.log('program.input', options.input);
18+
printTableFromInp(options.input);
19+
} else if (options.stdin) {
1620
printTableFromInp(fs.readFileSync(0).toString());
1721
} else {
1822
console.log('Error: Cant detect input option');

0 commit comments

Comments
 (0)