Skip to content

Highlight the diff between two LibreOffice spreadsheets

License

Notifications You must be signed in to change notification settings

sirap-group/node-ods-diff

Repository files navigation

node-ods-diff GitHub license GitHub tag

Highlight the diff between two LibreOffice spreadsheets with the simple node and CLI interfaces of ods-diff

NPM version JavaScript Style Guide Semver 2.0

Build Status Coverage Status

build status coverage report

CLI

Installation

$ npm install --global ods-diff

Usage

Output version

$ odsdiff -V
0.1.0

Output usage help

$ odsdiff -h

  Usage: odsdiff [options]

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number
    -v, --verbose                 output all intermediate steps informations
    -o, --f1 <path>               path of the original file to diff from
    -m, --f2, <path>              path of the modified file to diff to
    -O, --out [<path>]            destination path for the .ods diff output file
    -d, --csv-delimiter [<char>]  change the character delimiter for the CSV intermediate files

Standard usage:

$ odsdiff --f1 ./docs/v1/report.ods --f2 ./docs/v2/report.ods --out ./docs/report.diff.ods

Node API

Installation

$ npm install --save ods-diff

Usage

const odsDiff = require('ods-diff')
const path = require('path')

const reportv1Path = path.resolve('./docs/v1/report.ods')
const reportv2Path = path.resolve('./docs/v2/report.ods')
const reportDiffPath = path.resolve('./docs/report.diff.ods')

const odsDiffOptions = {
  cvsDelimiter: ','     // default: ';'
  verbose: true,        // default: false
  out: reportDiffPath   // default patern: './<f1_basepath>/<f1_basename>__diff__<f2_basename>.ods'
}


odsDiff(reportv1Path, reportv2Path, odsDiffOptions)
.then(() => console.log('ODS diff file successfuly written: ' + reportDiffPath))
.catch(err => console.error(err))

Note

Please note what name you must use depending what you are going to do with ods-diff

The repository name is node-ods-diff to show it is a node.js module

$ git clone https://github.com/sirap-group/node-ods-diff

The package name is ods-diff because we are in node.js context

$ npm i -s ods-diff
const odsDiff = require('ods-diff')

The CLI command is odsdiff, because it is more standard as a *nix CLI tool and it is quicker to tape on keyboard.

$ npm i -g ods-diff
$ odsdiff -v
1.1.0

Contributing

Pull Requests are welcome !

The code of the Node.js API is in index.js, and the code for the CLI API is located in bin/cli.js.

The code respects the standard js code style, please follow it too.

Standard - JavaScript Style Guide

Please note the following list of goals to achieve before starting to contribute.

TODO:

  • refactor index.js replacing most of the functions by prototypes and methods
  • write unit tests
  • setup gulp build with
    • js lint (standard)
    • run tests
    • run test coverage
    • watch changes then lint, test and coverage

License

MIT © Rémi Becheras, Groupe SIRAP

About

Highlight the diff between two LibreOffice spreadsheets

Resources

License

Stars

Watchers

Forks

Packages

No packages published