module Tdiff
Overview
Tdiff is a CLI utility for comparing tree-like files (json/yaml).
You can check out the source code at github: https://github.com/aleandros/tdiff
There are three main layers to the structure of the application:
Tdiff::Arguments
is in charge of handling user input and properly parse the given input files. The resulting data structure that's of interest isTdiff::Tree
, which is a general representation of a tree input source that ultimately feeds the core of the comparison algorithm.
Tdiff::Core
handles the output from the Arguments layer and executes the appropriate comparisons, ultimately returning anArray(Tdiff::Core::Result)
. An individualTdiff::Core::Result
object contains the difference between the two leafs and the path that lead to them.
Tdiff::Presentation
uses the array of result objects for presenting the data to the user, depending on the desired format.
This file serves as an entrypoint for the application, and essentially handles the arguments with OptionParser and connects the aforementioned layers.
Defined in:
exception.crtdiff.cr
Constant Summary
-
VERSION =
"0.2.1"
Class Method Summary
-
.compare(source : IO, target : IO)
This is the main entrypoint for using Tdiff as a library.
-
.fail_with_help(message : String, parser : OptionParser)
Prints usage error in the program arguments and terminates the program.
-
.main
This method is intended to be used for the CLI program.
Class Method Detail
This is the main entrypoint for using Tdiff as a library. It just requires a couple of IO
objects, containing the YAML or JSON data, and returns a list of Tdiff:Core::Result
objects.
require
If any of the inputs cannot be parsed, this method will raise a Tdiff::Exception
error.
Prints usage error in the program arguments and terminates the program.
A utility function that simply prints an error to STDERR and the program's help (since this should be used for indicating an error by the user in the provided) parameters.
This method is intended to be used for the CLI program.
The reason is that by encapsulating it, tdiff can be required as a library,
and the main.cr
file actually calls this function.