Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

table-printer-cli

Package Overview
Dependencies
Maintainers
1
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-printer-cli - npm Package Compare versions

Comparing version 0.0.11 to 1.0.0

17

dist/index.js

@@ -5,2 +5,17 @@ #!/usr/bin/env node

const service_1 = require("./src/service");
service_1.default(process.argv);
const commander_1 = require("commander");
const fs = require("fs");
commander_1.program
.option('-i, --input <value>', 'input string')
.option('-s, --stdin', 'read input from stdin')
.parse(process.argv);
if (commander_1.program.input) {
console.log('program.input', commander_1.program.input);
service_1.default(commander_1.program.input);
}
else if (commander_1.program.stdin) {
service_1.default(fs.readFileSync(0).toString());
}
else {
console.log('Error: Cant detect input option');
}

2

dist/src/inputVerifier.d.ts

@@ -1,2 +0,2 @@

declare const verifyInput: (args: string[]) => Boolean;
export declare const verifyInput: (inp: string) => Boolean;
export default verifyInput;

@@ -7,3 +7,3 @@ "use strict";

if (!Array.isArray(jsonObj)) {
console.log('c');
console.log('input Not an array');
return false;

@@ -18,12 +18,8 @@ }

};
const verifyInput = (args) => {
if (args.length !== 3) {
console.log('only one param allowed');
exports.verifyInput = (inp) => {
if (!isValidJson(inp)) {
return false;
}
if (!isValidJson(args[2])) {
return false;
}
return true;
};
exports.default = verifyInput;
exports.default = exports.verifyInput;

@@ -1,2 +0,2 @@

declare const printTableFromArgs: (args: string[]) => string | void;
export default printTableFromArgs;
declare const printTableFromInp: (inp: string) => string | void;
export default printTableFromInp;

@@ -5,11 +5,10 @@ "use strict";

const inputVerifier_1 = require("./inputVerifier");
const banner_1 = require("./banner");
const printTableFromArgs = (args) => {
if (!inputVerifier_1.default(args)) {
console.log(banner_1.default);
const printTableFromInp = (inp) => {
if (!inputVerifier_1.default(inp)) {
console.log(`not a valid input ${inp}`);
return;
}
const jsonInp = JSON.parse(args[2]);
const jsonInp = JSON.parse(inp);
console_table_printer_1.printTable(jsonInp);
};
exports.default = printTableFromArgs;
exports.default = printTableFromInp;
{
"name": "table-printer-cli",
"version": "0.0.11",
"version": "1.0.0",
"description": "console table printer cli. Print table on bash terminal",

@@ -35,2 +35,3 @@ "main": "dist/index.js",

"dependencies": {
"commander": "^5.1.0",
"console-table-printer": "^1.4.3"

@@ -37,0 +38,0 @@ },

@@ -46,3 +46,3 @@ <h1 align="center">table-printer-cli</h1>

```bash
ctp '[{ "id":3, "text":"like" }, {"id":4, "text":"tea"}]'
ctp -i '[{ "id":3, "text":"like" }, {"id":4, "text":"tea"}]'
```

@@ -54,4 +54,21 @@

You can also pipe the input from stdin
```bash
echo '[{ "id":3, "text":"like" }, {"id":4, "text":"tea"}]' | ctp -s
```
## Detailed usage
```text
Usage: ctp [options]
Options:
-i, --input <value> input string
-s, --stdin read input from stdin
-h, --help display help for command
```
## License
[MIT](https://github.com/ayonious/table-printer-cli/blob/master/LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc