Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial version of diff command wrapper #966

Merged
merged 6 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tools/diff/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
categories:
- Text Manipulation
description: GNU diff tool that calculates the differences between two files.
homepage_url: http://www.gnu.org/software/diffutils/
long_description: |
The diff utility is a data comparison tool that calculates and displays the differences between two files.
Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented,
but it is like Levenshtein distance in that it tries to determine the smallest set of deletions and insertions
to create one file from the other. The diff command displays the changes made in a standard format, such that
both humans and machines can understand the changes and apply them: given one file and the changes, the other
file can be created.
name: diff
owner: bgruening
remote_repository_url: https://github.com/bgruening/galaxytools/tree/master/tools/diff
type: unrestricted
87 changes: 87 additions & 0 deletions tools/diff/diff.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<tool id="diff" name="diff" version="3.6+galaxy0">

<description>analyzes two files and generates a text file with information about the lines that are different.</description>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if diff is part of the coreutils package? If so we should probably depend on this package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added conda-forge package for diffutils 3.6 and requirement 😃


<stdio>
<exit_code range="2:" level="fatal" description="Something went wrong trying to check differences in files. Please check output log for more details." />
<regex match="diff: memory exhausted" source="stdout" level="fatal_oom" description="Out of memory error occurred" />
</stdio>

<command ><![CDATA[
diff -u '$input1' '$input2' > '$output1'
]]>
</command>

<inputs>
<param name="input1" type="data" format="txt" label="First input file" />
<param name="input2" type="data" format="txt" label="Second input file" />
</inputs>

<outputs>
<data name="output1" format="txt" />
</outputs>

<tests>
<test expect_exit_code="0" expect_failure="false">
<param name="input1" value="file1.txt" />
<param name="input2" value="file1.txt" />
<output name="output1">
<assert_contents>
<has_n_lines n="0" />
</assert_contents>
</output>
</test>
<test expect_exit_code="1" expect_failure="false">
<param name="input1" value="file1.txt" />
<param name="input2" value="file2.txt" />
<output name="output1">
<assert_contents>
<has_n_lines n="5" />
<has_line line=" a" />
<has_line line="+b" />
</assert_contents>
</output>
</test>
</tests>

<help><![CDATA[
.. class:: infomark

**Purpose**

The **diff** utility is a data comparison tool that calculates and displays the differences between two files.

Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented, but it is like Levenshtein distance in that it tries to determine the smallest set of deletions and insertions to create one file from the other.

The diff command displays the changes made in a standard format, such that both humans and machines can understand the changes and apply them: given one file and the changes, the other file can be created.

.. class:: infomark

**Input**

Two text files to be checked for differences line by line.

.. class:: infomark

**Output**

A *single text file*, either:

- containing the lines differences in **unified format** (*unidiff*),

- or an **empty** file if the two input files are the same.
]]>
</help>

<citations>
<citation type="bibtex">
@misc{gnudiffutils,
author = {The Free Software Foundation (FSF), Inc},
year = {2017},
title = {diff (GNU diffutils)},
publisher = {The Free Software Foundation (FSF), Inc},
url = {http://www.gnu.org/software/diffutils/},
}
</citation>
</citations>
</tool>
1 change: 1 addition & 0 deletions tools/diff/test-data/file1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a
2 changes: 2 additions & 0 deletions tools/diff/test-data/file2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a
b