Repository 'diff'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/diff

Changeset 4:10ef1bf99074 (2024-12-09)
Previous changeset 3:156d0908e232 (2021-03-12) Next changeset 5:be2d899bf34a (2025-04-09)
Commit message:
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/diff commit 1a6c4a793ef68a43de93316523c1cd9196d80b73
modified:
diff.xml
added:
test-data/file3.txt
test-data/output_test4.txt
removed:
test-data/file 3.txt
b
diff -r 156d0908e232 -r 10ef1bf99074 diff.xml
--- a/diff.xml Fri Mar 12 16:22:44 2021 +0000
+++ b/diff.xml Mon Dec 09 14:36:40 2024 +0000
[
b'@@ -1,7 +1,7 @@\n-<tool id="diff" name="diff" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@">\n+<tool id="diff" name="diff" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@" profile="23.0">\n     <description>analyzes two files and generates an unidiff text file with information about the differences and an optional Html report</description>\n     <macros>\n-        <token name="@TOOL_VERSION@">3.7</token>\n+        <token name="@TOOL_VERSION@">3.10</token>\n         <token name="@GALAXY_VERSION@">0</token>\n     </macros>\n     <requirements>\n@@ -13,10 +13,18 @@\n         <regex match="diff: memory exhausted" source="stdout" level="fatal_oom" description="Out of memory error occurred"/>\n     </stdio>\n     <command><![CDATA[\n-        diff -u \'$input1\' \'$input2\' > \'$diff_file\';\n-        #if $generate_report:\n+        diff\n+        #if $report_format.report_format_select == \'txt_lines\' or $report_format.report_format_select == \'html\'\n+            ## the -u option is needed to convert the output later to HTML\n+            --unified=$report_format.unified\n+        #else if $report_format.report_format_select == \'txt_columns\'\n+            -y\n+        #end if\n+        ## If the compared input files differ the diff command returns exit-code 1\n+        \'$input1\' \'$input2\' > \'$diff_file\' || [ \\$? -eq 1 ];\n+        #if $report_format.report_format_select == \'html\'\n             sed -e \'s/@@title@@/Diff report for "$input1.element_identifier" and "$input2.element_identifier"/g\'\n-                -e \'s/@@outputformat@@/\'$output_format\'/g\'\n+                -e \'s/@@outputformat@@/\'$report_format.output_format\'/g\'\n                 -e \'/@@diffoutput@@/{r\'$diff_file\'\' -e \';d}\'\n                 \'$__tool_directory__/template.html\' > \'$html_file\'\n         #end if\n@@ -25,33 +33,50 @@\n     <inputs>\n         <param name="input1" type="data" format="txt" label="First input file"/>\n         <param name="input2" type="data" format="txt" label="Second input file"/>\n-        <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"/>\n-        <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.">\n-            <option value="side-by-side">Side by side</option>\n-            <option value="line-by-line">Line by line</option>\n-        </param>\n+        <conditional name="report_format">\n+            <param name="report_format_select" type="select" label="Choose a report format">\n+                <option value="txt_lines">Text file, line-by-line (-u)</option>\n+                <option value="txt_columns">Text file, side-by-side (-y)</option>\n+                <option value="html">Generates an HTML report to visualize the differences</option>\n+            </param>\n+            <when value="txt_lines">\n+                <param argument="--unified" type="integer" min="0" value="3" label="Output this amount of lines of unified context"/>\n+            </when>\n+            <when value="txt_columns"/>\n+            <when value="html">\n+                <param argument="--unified" type="integer" min="0" value="3" label="Output this amount of lines of unified context"/>\n+                <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.">\n+                    <option value="side-by-side">Side by side</option>\n+                    <option value="line-by-line">Line by line</option>\n+                </param>\n+            </when>\n+        </conditional>\n     </inputs>\n     <outputs>\n         <data format="txt" name="diff_file" from_work_dir="output.txt" label="${tool.name} on ${on_string}: Raw Output"/>\n         <data format="html" name="html_file" from_work_dir="output.html" label="${tool.name} on'..b'= \'html\'</filter>\n         </data>\n     </outputs>\n     <tests>\n         <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1">\n             <param name="input1" value="file1.txt"/>\n             <param name="input2" value="file1.txt"/>\n-            <param name="generate_report" value="false"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="txt_lines"/>\n+            </conditional>\n             <output name="diff_file">\n                 <assert_contents>\n                     <has_n_lines n="0"/>\n                 </assert_contents>\n             </output>\n         </test>\n-        <test expect_exit_code="1" expect_failure="false" expect_num_outputs="1">\n+        <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1">\n             <param name="input1" value="file1.txt"/>\n             <param name="input2" value="file2.txt"/>\n-            <param name="generate_report" value="false"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="txt_lines"/>\n+            </conditional>\n             <output name="diff_file">\n                 <assert_contents>\n                     <has_n_lines n="5"/>\n@@ -63,7 +88,9 @@\n         <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2">\n             <param name="input1" value="file1.txt"/>\n             <param name="input2" value="file2.txt"/>\n-            <param name="generate_report" value="true"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="html"/>\n+            </conditional>\n             <output name="html_file">\n                 <assert_contents>\n                     <has_text text="!DOCTYPE html"/>\n@@ -73,8 +100,10 @@\n         <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2">\n             <param name="input1" value="file1.txt"/>\n             <param name="input2" value="file2.txt"/>\n-            <param name="generate_report" value="true"/>\n-            <param name="output_format" value="side-by-side"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="html"/>\n+                <param name="output_format" value="side-by-side"/>\n+            </conditional>\n             <output name="html_file">\n                 <assert_contents>\n                     <has_text text="!DOCTYPE html"/>\n@@ -85,8 +114,10 @@\n         <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2">\n             <param name="input1" value="file1.txt"/>\n             <param name="input2" value="file2.txt"/>\n-            <param name="generate_report" value="true"/>\n-            <param name="output_format" value="line-by-line"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="html"/>\n+                <param name="output_format" value="line-by-line"/>\n+            </conditional>\n             <output name="html_file">\n                 <assert_contents>\n                     <has_text text="!DOCTYPE html"/>\n@@ -95,9 +126,12 @@\n             </output>\n         </test>\n         <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2">\n-            <param name="input1" value="file 3.txt"/>\n-            <param name="input2" value="file 3.txt"/>\n-            <param name="generate_report" value="true"/>\n+            <param name="input1" value="file3.txt"/>\n+            <param name="input2" value="file3.txt"/>\n+            <conditional name="report_format">\n+                <param name="report_format_select" value="html"/>\n+                <param name="output_format" value="side-by-side"/>\n+            </conditional>\n             <output name="diff_file">\n                 <assert_contents>\n                     <has_n_lines n="0"/>\n@@ -169,4 +203,4 @@\n             }\n         </citation>\n     </citations>\n-</tool>\n+</tool>\n\\ No newline at end of file\n'
b
diff -r 156d0908e232 -r 10ef1bf99074 test-data/file 3.txt
--- a/test-data/file 3.txt Fri Mar 12 16:22:44 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,1 +0,0 @@
-c
b
diff -r 156d0908e232 -r 10ef1bf99074 test-data/file3.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/file3.txt Mon Dec 09 14:36:40 2024 +0000
b
@@ -0,0 +1,1 @@
+c
b
diff -r 156d0908e232 -r 10ef1bf99074 test-data/output_test4.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_test4.txt Mon Dec 09 14:36:40 2024 +0000
b
@@ -0,0 +1,2 @@
+a a
+       > b