github.com/tacerus/ldifdiff@v0.0.0-20181030102753-4dccbe38183b/README.md (about)

     1  # ldifdiff
     2  ldiffdiff is a fast Go (golang) library and executable that output the
     3  difference between two LDIF files as a valid and importable LDIF (e.g.
     4  by your LDAP server). Binaries of the command implementation are 
     5  provided under [releases](https://github.com/nxadm/ldifdiff/releases).
     6  
     7  [![Build Status](https://travis-ci.org/nxadm/ldifdiff.svg?branch=master)](https://travis-ci.org/nxadm/ldifdiff)
     8  [![GoDoc](https://godoc.org/github.com/nxadm/ldifdiff?status.svg)](https://godoc.org/github.com/nxadm/ldifdiff)
     9  [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0)
    10  
    11  ## Usage of the ldifdiff command
    12  ```
    13  $ ./ldifdiff -h
    14  ldifdiff v0.1.0 (Claudio Ramirez <pub.claudio@gmail.com>).
    15  Compare two LDIF files and output the differences as a valid LDIF.
    16  Bugs to https://github.com/nxadm/ldifdiff.
    17  
    18         _       _       _       _       _       _       _       _
    19      _-(_)-  _-(_)-  _-(_)-  _-(")-  _-(_)-  _-(_)-  _-(_)-  _-(_)-
    20    *(___)  *(___)  *(___)  *%%%%%  *(___)  *(___)  *(___)  *(___)
    21     // \\   // \\   // \\   // \\   // \\   // \\   // \\   // \\
    22  
    23  Usage:
    24    ldifdiff <source> <target> [-i <attributes> ...] [-d]
    25    ldifdiff -h
    26    ldifdiff -v
    27  Options:
    28    -d, --dn
    29      Only print DNs instead of a full LDIF.
    30    -i <attributes>, --ignore <attributes>
    31      Comma separated attribute list.
    32      Multiple instances of this switch are allowed.
    33    -h, --help
    34      Show this screen.
    35    -v, --version
    36      Show version.
    37  ```
    38  
    39  ## Installation
    40  
    41  Download the library using go:
    42  ```go get github.com/nxadm/ldifdiff```
    43  
    44  Import the library into your project:
    45  ```import "github.com/nxadm/ldifdiff"```
    46  
    47  Compile the ldiff cmd implementation:
    48  ```cd cmd; go build -o ldifdiff ldifdiff.go```
    49  
    50  
    51  ## API ##
    52  
    53  The API is simple and provides four functions.
    54  
    55  ```func Diff(sourceStr, targetStr string, ignoreAttr []string) (string, error)```
    56  
    57  Diff compares two LDIF strings (sourceStr and targetStr) and outputs the
    58  differences as a LDIF string. An array of attributes can be supplied.
    59  These attributes will be ignored when comparing the LDIF strings. The
    60  output is a string, a valid LDIF, and can be added to the _target_
    61  database (the one that created targetStr) in order to make it equal to
    62  the _source_ database (the one that created sourceStr). In case of
    63  failure, an error is provided.
    64  
    65  
    66  ```func DiffFromFiles(sourceFile, targetFile string, ignoreAttr []string) (string, error)```
    67  
    68  DiffFromFiles compares two LDIF files (sourceFile and targetFile) and
    69  outputs the differences as a LDIF string. An array of attributes can be
    70  supplied. These attributes will be ignored when comparing the LDIF
    71  strings. The output is a string, a valid LDIF, and can be added to the
    72  _target_ database (the one that created targetFile) in order to make it
    73  equal to the _source_ database (the one that created sourceFile). In
    74  case of failure, an error is provided.
    75  
    76  ```func ListDiffDn(sourceStr, targetStr string, ignoreAttr []string) ([]string, error)```
    77  
    78  ListDiffDn compares two LDIF strings (sourceStr and targetStr) and
    79  outputs the differences as a list of affected DNs (Dintinguished Names).
    80  An array of attributes can be supplied. These attributes will be ignored
    81  when comparing the LDIF strings. The output is a string slice. In case
    82  of failure, an error is provided.
    83  
    84  ```func ListDiffDnFromFiles(sourceFile, targetFile string, ignoreAttr []string) ([]string, error)```
    85  
    86  ListDiffDnFromFiles compares two LDIF files (sourceFile and
    87  targetFileStr) and outputs the differences as a list of affected DNs
    88  (Dintinguished Names). An array of attributes can be supplied. These
    89  attributes will be ignored when comparing the LDIF strings. The output
    90  is a string slice. In case of failure, an error is provided.
    91