Mercurial > repos > bgruening > diff
diff diff.xml @ 1:02dfbbf869d8 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/diff commit d1ef0f3da4118bf352c5acf720f277fc5ef07665"
author | bgruening |
---|---|
date | Tue, 14 Apr 2020 13:56:01 -0400 |
parents | 8a18547725cf |
children | 95a9dc82fc9a |
line wrap: on
line diff
--- a/diff.xml Tue Mar 31 16:36:28 2020 -0400 +++ b/diff.xml Tue Apr 14 13:56:01 2020 -0400 @@ -1,9 +1,10 @@ -<tool id="diff" name="diff" version="3.6+galaxy0"> +<tool id="diff" name="diff" version="3.6+galaxy1"> - <description>analyzes two files and generates a text file with information about the lines that are different</description> + <description>analyzes two files and generates an unidiff text file with information about the differences and an optional Html report</description> <requirements> <requirement type="package" version="3.6">diffutils</requirement> + <requirement type="package" version="4.7">sed</requirement> </requirements> <stdio> @@ -12,33 +13,49 @@ </stdio> <command ><![CDATA[ - diff -u '$input1' '$input2' > '$output1' + diff -u '$input1' '$input2' > '$diff_file'; + #if $generate_report: + sed -e 's/@@title@@/Diff report for '$input1.element_identifier' and '$input2.element_identifier'/g' + -e 's/@@outputformat@@/'$output_format'/g' + -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' + '$__tool_directory__/template.html' > '$html_file' + #end if ]]> </command> <inputs> <param name="input1" type="data" format="txt" label="First input file" /> <param name="input2" type="data" format="txt" label="Second input file" /> + <param name="generate_report" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Generate HTML report" help="Generates an HTML report to visualize the differences"/> + <param name="output_format" type="select" label="Choose report output format" help="Displays the differences in the report using the selected format. Either line by line or side by side."> + <option value="side-by-side">Side by side</option> + <option value="line-by-line">Line by line</option> + </param> </inputs> <outputs> - <data name="output1" format="txt" /> + <data format="txt" name="diff_file" from_work_dir="output.txt" label="${tool.name} on ${on_string}: Raw Output" /> + <data format="html" name="html_file" from_work_dir="output.html" label="${tool.name} on ${on_string}: Html Report"> + <filter>generate_report is True</filter> + </data> </outputs> <tests> - <test expect_exit_code="0" expect_failure="false"> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1"> <param name="input1" value="file1.txt" /> <param name="input2" value="file1.txt" /> - <output name="output1"> + <param name="generate_report" value="false" /> + <output name="diff_file"> <assert_contents> <has_n_lines n="0" /> </assert_contents> </output> </test> - <test expect_exit_code="1" expect_failure="false"> + <test expect_exit_code="1" expect_failure="false" expect_num_outputs="1"> <param name="input1" value="file1.txt" /> <param name="input2" value="file2.txt" /> - <output name="output1"> + <param name="generate_report" value="false" /> + <output name="diff_file"> <assert_contents> <has_n_lines n="5" /> <has_line line=" a" /> @@ -46,6 +63,40 @@ </assert_contents> </output> </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + </assert_contents> + </output> + </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <param name="output_format" value="side-by-side" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + <has_text text="side-by-side" /> + </assert_contents> + </output> + </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <param name="output_format" value="line-by-line" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + <has_text text="line-by-line" /> + </assert_contents> + </output> + </test> </tests> <help><![CDATA[ @@ -69,11 +120,13 @@ **Output** -A *single text file*, either: +A *text file*, either: - containing the lines differences in **unified format** (*unidiff*), - or an **empty** file if the two input files are the same. + +An **optional** *HTML report* with a friendlier visual representation of the differences. ]]> </help> @@ -87,5 +140,23 @@ url = {http://www.gnu.org/software/diffutils/}, } </citation> + <citation type="bibtex"> + @misc{diff2html, + author = {Rodrigo Fernandes}, + year = {2014}, + title = {Pretty diff to html javascript library (diff2html)}, + publisher = {Github}, + url = {https://github.com/rtfpessoa/diff2html}, + } + </citation> + <citation type="bibtex"> + @misc{sed, + author = {The Free Software Foundation (FSF), Inc}, + year = {2017}, + title = {sed (GNU sed)}, + publisher = {The Free Software Foundation (FSF), Inc}, + url = {http://www.gnu.org/software/sed/}, + } + </citation> </citations> </tool>