🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cli-diff

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-diff

A diff utility with highlighted output for CLIs

1.0.0
latest
Source
npm
Version published
Weekly downloads
1.2K
9.69%
Maintainers
1
Weekly downloads
 
Created
Source

cli-diff

cli-diff on npm MIT Licensed Supported Node versions Build status Coverage via Codecov types: TypeScript standard-readme compliant

A diff utility with highlighted output for CLIs

cli-diff makes it easy for your CLI or script to output a highlighted diff. It doesn’t support syntax highlighting in the diff right now, but it does support highlighting line-by-line.

Table of Contents

Install

$ yarn add cli-diff
$ # or npm:
$ npm install cli-diff

Usage

import diff from 'cli-diff'
// or, if you prefer:
const diff = require('cli-diff').default

console.log(diff('hello', 'goodbye'))
/* output:
@@ -1,1 +1,1 @@
-hello
\ No newline at end of file
+goodbye
*/

console.log(
  diff(
    { name: 'old.txt', content: 'hello\nworld\n' },
    { name: 'new.txt', content: 'Hello, world!\n' }
  )
)
/* output:
--- old.txt
+++ new.txt
@@ -1,2 +1,1 @@
-hello
-world
+Hello, world!
*/

Maintainers

@j-f1

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2018 Jed Fox

FAQs

Package last updated on 24 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts