daff.Coopy
This is the main entry-point to the library and the associated command-line tool.
Type: class
Static Variables:
VERSION : String
Library version.
Static Methods:
compareTables (local : Table, remote : Table, ?flags : CompareFlags) : CompareTable
Prepare to compare two tables.
Parameters:
local
the reference version of the tableremote
another version of the tableflags
control how the comparison will be made
Returns: a worker you can use to make the comparison (normally you’ll just want to call
.align()
on it)
compareTables3 (parent : Table, local : Table, remote : Table, ?flags : CompareFlags) : CompareTable
Prepare to compare two tables, given knowledge of a common ancester.
The comparison will answer: what changes should be made to `local`
in order to incorporate the differences between `parent` and `remote`.
This is useful if the `local` table has changes in it that you want
to preserve.
Parameters:
parent
the common ancestor of thelocal
andremote
tableslocal
the reference version of the tableremote
another version of the tableflags
control how the comparison will be made
Returns: a worker you can use to make the comparison (normally you’ll just want to call
.align()
on it)
diff (local : Table, remote : Table, ?flags : CompareFlags) : Table
Compare two tables and visualize their difference as another table
Parameters:
local
the reference version of the tableremote
another version of the tableflags
control how the comparison will be made
Returns: a table like that produced by
daff a.csv b.csv
diffAsAnsi (local : Table, remote : Table, ?flags : CompareFlags) : String
Compare two tables and visualize their difference in text decorated with ansi console codes
Parameters:
local
the reference version of the tableremote
another version of the tableflags
control how the comparison will be made
Returns: a string like that produced by
daff --color a.csv b.csv
diffAsHtml (local : Table, remote : Table, ?flags : CompareFlags) : String
Compare two tables and visualize their difference using html
Parameters:
local
the reference version of the tableremote
another version of the tableflags
control how the comparison will be made
Returns: an html string like that produced by
daff --output-format html --fragment a.csv b.csv
main () : Int
This is the entry point for the daff command-line utility.
It is a thin wrapper around the `coopyhx` method.
patch (local : Table, patch : Table, ?flags : CompareFlags) : Bool
Apply a patch to a table.
Parameters:
local
the reference version of the tablepatch
the changes to apply (in daff format)flags
control how the patch operations will be made
Returns: true on success
tablify (data : Dynamic) : Table
This takes input in an unknown format and tries to make a table out of it,
through the power of guesswork.
Parameters:
t
an alleged table
Returns: a daff-compatible table, or null
Constructor:
new(?io : TableIO)
Methods:
coopyhx (io : TableIO) : Int
loadTable (name : String) : Table
Load a table from a file.
Parameters:
name
filename to read from
Returns: a table
run (args : Array<String>, ?io : TableIO) : Int
This implements the daff command-line utility.
Parameters:
args
the list of command-line argumentsio
should be an implementation of all the system services daff needs, if null one will be created
Returns: 0 on success, non-zero on error.