All Projects → rtfpessoa → Diff2html Cli

rtfpessoa / Diff2html Cli

Licence: mit
Pretty diff to html javascript cli (diff2html-cli)

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Diff2html Cli

Bat
A cat(1) clone with wings.
Stars: ✭ 30,833 (+10643.21%)
Mutual labels:  cli, hacktoberfest, syntax-highlighting
Diff2html
Pretty diff to html javascript library (diff2html)
Stars: ✭ 1,867 (+550.52%)
Mutual labels:  hacktoberfest, syntax-highlighting, diff
Vue Cli Plugin Electron Builder
Easily Build Your Vue.js App For Desktop With Electron
Stars: ✭ 3,549 (+1136.59%)
Mutual labels:  cli, hacktoberfest
Awesomescripts
A Collection of Awesome Scripts in Python to Ease Daily-Life. Create an issue If you have some great idea for the new script. Leave a ⭐️
Stars: ✭ 228 (-20.56%)
Mutual labels:  cli, hacktoberfest
Jenkins Cli
Jenkins CLI allows you manage your Jenkins as an easy way
Stars: ✭ 245 (-14.63%)
Mutual labels:  cli, hacktoberfest
Autarky
Liberating disk space from 📁 node_modules
Stars: ✭ 203 (-29.27%)
Mutual labels:  cli, hacktoberfest
Json 2 Csv
Convert JSON to CSV *or* CSV to JSON!
Stars: ✭ 210 (-26.83%)
Mutual labels:  cli, hacktoberfest
Ace
Node.js framework for creating command line applications
Stars: ✭ 233 (-18.82%)
Mutual labels:  cli, hacktoberfest
Tox
Command line driven CI frontend and development task automation tool.
Stars: ✭ 2,523 (+779.09%)
Mutual labels:  cli, hacktoberfest
diff-parser
A parser for unified diffs
Stars: ✭ 22 (-92.33%)
Mutual labels:  diff, unified
intellij-diff-plugin
Syntax highlighting for .diff files and .patch files in IntelliJ IDEs
Stars: ✭ 17 (-94.08%)
Mutual labels:  syntax-highlighting, diff
Fsociety
A Modular Penetration Testing Framework
Stars: ✭ 259 (-9.76%)
Mutual labels:  cli, hacktoberfest
Cypress Terminal Report
Better terminal and file output for cypress test logs.
Stars: ✭ 200 (-30.31%)
Mutual labels:  cli, hacktoberfest
Grank
Github 项目活跃度分析工具
Stars: ✭ 199 (-30.66%)
Mutual labels:  cli, hacktoberfest
Tldr
Golang command line client for tldr https://github.com/tldr-pages/tldr
Stars: ✭ 210 (-26.83%)
Mutual labels:  cli, hacktoberfest
Lighthouse Ci
A useful wrapper around Google Lighthouse CLI
Stars: ✭ 198 (-31.01%)
Mutual labels:  cli, hacktoberfest
Ten Hands
⚡ Simplest way to organize and run command-line tasks
Stars: ✭ 228 (-20.56%)
Mutual labels:  cli, hacktoberfest
Starcli
✨ Browse GitHub trending projects from your command line
Stars: ✭ 269 (-6.27%)
Mutual labels:  cli, hacktoberfest
Fpl
An asynchronous Python wrapper for the Fantasy Premier League API.
Stars: ✭ 169 (-41.11%)
Mutual labels:  cli, hacktoberfest
Delta
Delta is a command-line diff tool implemented in Go.
Stars: ✭ 178 (-37.98%)
Mutual labels:  cli, diff

diff2html-cli

Codacy Quality Badge Codacy Coverage Badge Circle CI

npm David David

node npm npm Gitter

Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal

Table of Contents

Features

  • Unified diff and Git diff input

  • line-by-line and side-by-side diff

  • new and old line numbers

  • inserted and removed lines

  • GitHub like style

  • Code syntax highlight

  • Line similarity matching

Online Example

Go to Diff2HTML

Distributions

Setup

npm install -g diff2html-cli

Usage

Usage: diff2html [ flags and/or options ] -- [git diff passthrough flags and options]

flag alias description choices default
-s --style Output style line, side line
--sc --synchronisedScroll Synchronised horizontal scroll true, false true
--hc --highlightCode Highlight code true, false true
--su --summary Show files summary closed, open, hidden closed
-d --diffStyle Diff style word, char word
--lm --matching Diff line matching type lines, words, none none
--lmt --matchWordsThreshold Diff line matching word threshold 0.25
--lmm --matchingMaxComparisons Diff line matching maximum line comparisons of a block of changes 2500
--hwt --htmlWrapperTemplate Path to custom template to be rendered when using the html output format [string]
-f --format Output format html, json html
-i --input Diff input source file, command, stdin command
-o --output Output destination preview, stdout preview
-u --diffy Upload to diffy.org browser, pbcopy, print
-F --file Send output to file (overrides output option) [string]
--ig --ignore Ignore particular files from the diff [string]
-v --version Show version number
-h --help Show help

Exit Status Codes

  • 🎉 0: Success
  • 😵 1: Generic Error
  • 😰 3: Input diff is empty
  • 👮 4: Value of --hwt | --htmlWrapperTemplate is not a valid file

Custom HTML wrapper template

The template is a very based on a simple replace of several placeholders as coded https://github.com/rtfpessoa/diff2html-cli/blob/master/src/cli.ts#L40

To provide a custom template you need to make sure you have the following comments and imports in your HTML, exactly as they are here:

  • Inside the <head> tag
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css" />
<!--diff2html-css-->
<!--diff2html-js-ui-->
<script>
  document.addEventListener('DOMContentLoaded', () => {
    const targetElement = document.getElementById('diff');
    const diff2htmlUi = new Diff2HtmlUI(targetElement);
    //diff2html-fileListToggle
    //diff2html-synchronisedScroll
    //diff2html-highlightCode
  });
</script>
  • Inside the <body> tag
<div id="diff">
  <!--diff2html-diff-->
</div>

Examples

diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1

  • diff last commit, line by line, word comparison between lines, previewed in the browser and input from git diff command

diff2html -i file -- my-file-diff.diff

  • reading the input from a file

diff -u file1.txt file2.txt | diff2html -i stdin

  • reading diff from stdin

diff2html -f json -o stdout -- -M HEAD~1

  • print json format to stdout

diff2html -F my-pretty-diff.html -- -M HEAD~1

  • print to file

diff2html -F my-pretty-diff.html --hwt my-custom-template.html -- -M HEAD~1

  • print to file using custom markup templates can include the following variables

diff2html --ig package-lock.json --ig yarn.lock

  • Ignore package-lock.json and yarn.lock from the generated diff

NOTE: notice the -- in the examples

Contribute

This is a developer friendly project, all the contributions are welcome. To contribute just send a pull request with your changes following the guidelines described in CONTRIBUTING.md. I will try to review them as soon as possible.

Developing

Make some changes, yarn build and then ./bin/diff2html 😉

License

Copyright 2014-present Rodrigo Fernandes. Released under the terms of the MIT license.

Thanks

This project is inspired in pretty-diff by Scott González.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].