From a596db031fc96f8a13233e7106f4d48d1298b2b7 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Tue, 13 Mar 2018 10:28:40 +0700 Subject: [PATCH] Use jsome instead of cardinal --- index.js | 14 +++++--------- package.json | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 0610cc6..9ee2f5d 100755 --- a/index.js +++ b/index.js @@ -1,9 +1,8 @@ #!/usr/bin/env node -'use strict'; +'use strict' const meow = require('meow') const stdin = require('get-stdin') -const cardinal = require('cardinal') -const theme = require('cardinal/themes/tomorrow-night') +const jsome = require('jsome') const cli = meow(` Usage @@ -23,10 +22,6 @@ const cli = meow(` {"count": 1} `) - - -const highlight = process.stdout.isTTY ? cardinal.highlight : x => x - async function main() { const text = await stdin() @@ -39,9 +34,10 @@ async function main() { if (typeof result === 'undefined') { process.stderr.write('undefined\n') + } else if (process.stdout.isTTY) { + jsome(result) } else { - const text = JSON.stringify(result, null, 4) - console.log(highlight(text, {theme})) + console.log(JSON.stringify(result, null, 2)) } } diff --git a/package.json b/package.json index a1268cd..2b8a11e 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "node": ">=9" }, "dependencies": { - "cardinal": "^1.0.0", "get-stdin": "^5.0.1", + "jsome": "^2.5.0", "meow": "^4.0.0" }, "devDependencies": {