Mercurial > repos > bgruening > diff
comparison diff.xml @ 4:10ef1bf99074 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/diff commit 1a6c4a793ef68a43de93316523c1cd9196d80b73
| author | bgruening |
|---|---|
| date | Mon, 09 Dec 2024 14:36:40 +0000 |
| parents | 156d0908e232 |
| children | be2d899bf34a |
comparison
equal
deleted
inserted
replaced
| 3:156d0908e232 | 4:10ef1bf99074 |
|---|---|
| 1 <tool id="diff" name="diff" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@"> | 1 <tool id="diff" name="diff" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@" profile="23.0"> |
| 2 <description>analyzes two files and generates an unidiff text file with information about the differences and an optional Html report</description> | 2 <description>analyzes two files and generates an unidiff text file with information about the differences and an optional Html report</description> |
| 3 <macros> | 3 <macros> |
| 4 <token name="@TOOL_VERSION@">3.7</token> | 4 <token name="@TOOL_VERSION@">3.10</token> |
| 5 <token name="@GALAXY_VERSION@">0</token> | 5 <token name="@GALAXY_VERSION@">0</token> |
| 6 </macros> | 6 </macros> |
| 7 <requirements> | 7 <requirements> |
| 8 <requirement type="package" version="@TOOL_VERSION@">diffutils</requirement> | 8 <requirement type="package" version="@TOOL_VERSION@">diffutils</requirement> |
| 9 <requirement type="package" version="4.8">sed</requirement> | 9 <requirement type="package" version="4.8">sed</requirement> |
| 11 <stdio> | 11 <stdio> |
| 12 <exit_code range="2:" level="fatal" description="Something went wrong trying to check differences in files. Please check output log for more details."/> | 12 <exit_code range="2:" level="fatal" description="Something went wrong trying to check differences in files. Please check output log for more details."/> |
| 13 <regex match="diff: memory exhausted" source="stdout" level="fatal_oom" description="Out of memory error occurred"/> | 13 <regex match="diff: memory exhausted" source="stdout" level="fatal_oom" description="Out of memory error occurred"/> |
| 14 </stdio> | 14 </stdio> |
| 15 <command><![CDATA[ | 15 <command><![CDATA[ |
| 16 diff -u '$input1' '$input2' > '$diff_file'; | 16 diff |
| 17 #if $generate_report: | 17 #if $report_format.report_format_select == 'txt_lines' or $report_format.report_format_select == 'html' |
| 18 ## the -u option is needed to convert the output later to HTML | |
| 19 --unified=$report_format.unified | |
| 20 #else if $report_format.report_format_select == 'txt_columns' | |
| 21 -y | |
| 22 #end if | |
| 23 ## If the compared input files differ the diff command returns exit-code 1 | |
| 24 '$input1' '$input2' > '$diff_file' || [ \$? -eq 1 ]; | |
| 25 #if $report_format.report_format_select == 'html' | |
| 18 sed -e 's/@@title@@/Diff report for "$input1.element_identifier" and "$input2.element_identifier"/g' | 26 sed -e 's/@@title@@/Diff report for "$input1.element_identifier" and "$input2.element_identifier"/g' |
| 19 -e 's/@@outputformat@@/'$output_format'/g' | 27 -e 's/@@outputformat@@/'$report_format.output_format'/g' |
| 20 -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' | 28 -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' |
| 21 '$__tool_directory__/template.html' > '$html_file' | 29 '$__tool_directory__/template.html' > '$html_file' |
| 22 #end if | 30 #end if |
| 23 ]]> | 31 ]]> |
| 24 </command> | 32 </command> |
| 25 <inputs> | 33 <inputs> |
| 26 <param name="input1" type="data" format="txt" label="First input file"/> | 34 <param name="input1" type="data" format="txt" label="First input file"/> |
| 27 <param name="input2" type="data" format="txt" label="Second input file"/> | 35 <param name="input2" type="data" format="txt" label="Second input file"/> |
| 28 <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"/> | 36 <conditional name="report_format"> |
| 29 <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."> | 37 <param name="report_format_select" type="select" label="Choose a report format"> |
| 30 <option value="side-by-side">Side by side</option> | 38 <option value="txt_lines">Text file, line-by-line (-u)</option> |
| 31 <option value="line-by-line">Line by line</option> | 39 <option value="txt_columns">Text file, side-by-side (-y)</option> |
| 32 </param> | 40 <option value="html">Generates an HTML report to visualize the differences</option> |
| 41 </param> | |
| 42 <when value="txt_lines"> | |
| 43 <param argument="--unified" type="integer" min="0" value="3" label="Output this amount of lines of unified context"/> | |
| 44 </when> | |
| 45 <when value="txt_columns"/> | |
| 46 <when value="html"> | |
| 47 <param argument="--unified" type="integer" min="0" value="3" label="Output this amount of lines of unified context"/> | |
| 48 <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."> | |
| 49 <option value="side-by-side">Side by side</option> | |
| 50 <option value="line-by-line">Line by line</option> | |
| 51 </param> | |
| 52 </when> | |
| 53 </conditional> | |
| 33 </inputs> | 54 </inputs> |
| 34 <outputs> | 55 <outputs> |
| 35 <data format="txt" name="diff_file" from_work_dir="output.txt" label="${tool.name} on ${on_string}: Raw Output"/> | 56 <data format="txt" name="diff_file" from_work_dir="output.txt" label="${tool.name} on ${on_string}: Raw Output"/> |
| 36 <data format="html" name="html_file" from_work_dir="output.html" label="${tool.name} on ${on_string}: Html Report"> | 57 <data format="html" name="html_file" from_work_dir="output.html" label="${tool.name} on ${on_string}: Html Report"> |
| 37 <filter>generate_report is True</filter> | 58 <filter>report_format['report_format_select'] == 'html'</filter> |
| 38 </data> | 59 </data> |
| 39 </outputs> | 60 </outputs> |
| 40 <tests> | 61 <tests> |
| 41 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1"> | 62 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1"> |
| 42 <param name="input1" value="file1.txt"/> | 63 <param name="input1" value="file1.txt"/> |
| 43 <param name="input2" value="file1.txt"/> | 64 <param name="input2" value="file1.txt"/> |
| 44 <param name="generate_report" value="false"/> | 65 <conditional name="report_format"> |
| 66 <param name="report_format_select" value="txt_lines"/> | |
| 67 </conditional> | |
| 45 <output name="diff_file"> | 68 <output name="diff_file"> |
| 46 <assert_contents> | 69 <assert_contents> |
| 47 <has_n_lines n="0"/> | 70 <has_n_lines n="0"/> |
| 48 </assert_contents> | 71 </assert_contents> |
| 49 </output> | 72 </output> |
| 50 </test> | 73 </test> |
| 51 <test expect_exit_code="1" expect_failure="false" expect_num_outputs="1"> | 74 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1"> |
| 52 <param name="input1" value="file1.txt"/> | 75 <param name="input1" value="file1.txt"/> |
| 53 <param name="input2" value="file2.txt"/> | 76 <param name="input2" value="file2.txt"/> |
| 54 <param name="generate_report" value="false"/> | 77 <conditional name="report_format"> |
| 78 <param name="report_format_select" value="txt_lines"/> | |
| 79 </conditional> | |
| 55 <output name="diff_file"> | 80 <output name="diff_file"> |
| 56 <assert_contents> | 81 <assert_contents> |
| 57 <has_n_lines n="5"/> | 82 <has_n_lines n="5"/> |
| 58 <has_line line=" a"/> | 83 <has_line line=" a"/> |
| 59 <has_line line="+b"/> | 84 <has_line line="+b"/> |
| 61 </output> | 86 </output> |
| 62 </test> | 87 </test> |
| 63 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> | 88 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> |
| 64 <param name="input1" value="file1.txt"/> | 89 <param name="input1" value="file1.txt"/> |
| 65 <param name="input2" value="file2.txt"/> | 90 <param name="input2" value="file2.txt"/> |
| 66 <param name="generate_report" value="true"/> | 91 <conditional name="report_format"> |
| 67 <output name="html_file"> | 92 <param name="report_format_select" value="html"/> |
| 68 <assert_contents> | 93 </conditional> |
| 69 <has_text text="!DOCTYPE html"/> | 94 <output name="html_file"> |
| 70 </assert_contents> | 95 <assert_contents> |
| 71 </output> | 96 <has_text text="!DOCTYPE html"/> |
| 72 </test> | 97 </assert_contents> |
| 73 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> | 98 </output> |
| 74 <param name="input1" value="file1.txt"/> | 99 </test> |
| 75 <param name="input2" value="file2.txt"/> | 100 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> |
| 76 <param name="generate_report" value="true"/> | 101 <param name="input1" value="file1.txt"/> |
| 77 <param name="output_format" value="side-by-side"/> | 102 <param name="input2" value="file2.txt"/> |
| 103 <conditional name="report_format"> | |
| 104 <param name="report_format_select" value="html"/> | |
| 105 <param name="output_format" value="side-by-side"/> | |
| 106 </conditional> | |
| 78 <output name="html_file"> | 107 <output name="html_file"> |
| 79 <assert_contents> | 108 <assert_contents> |
| 80 <has_text text="!DOCTYPE html"/> | 109 <has_text text="!DOCTYPE html"/> |
| 81 <has_text text="side-by-side"/> | 110 <has_text text="side-by-side"/> |
| 82 </assert_contents> | 111 </assert_contents> |
| 83 </output> | 112 </output> |
| 84 </test> | 113 </test> |
| 85 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> | 114 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> |
| 86 <param name="input1" value="file1.txt"/> | 115 <param name="input1" value="file1.txt"/> |
| 87 <param name="input2" value="file2.txt"/> | 116 <param name="input2" value="file2.txt"/> |
| 88 <param name="generate_report" value="true"/> | 117 <conditional name="report_format"> |
| 89 <param name="output_format" value="line-by-line"/> | 118 <param name="report_format_select" value="html"/> |
| 119 <param name="output_format" value="line-by-line"/> | |
| 120 </conditional> | |
| 90 <output name="html_file"> | 121 <output name="html_file"> |
| 91 <assert_contents> | 122 <assert_contents> |
| 92 <has_text text="!DOCTYPE html"/> | 123 <has_text text="!DOCTYPE html"/> |
| 93 <has_text text="line-by-line"/> | 124 <has_text text="line-by-line"/> |
| 94 </assert_contents> | 125 </assert_contents> |
| 95 </output> | 126 </output> |
| 96 </test> | 127 </test> |
| 97 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> | 128 <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> |
| 98 <param name="input1" value="file 3.txt"/> | 129 <param name="input1" value="file3.txt"/> |
| 99 <param name="input2" value="file 3.txt"/> | 130 <param name="input2" value="file3.txt"/> |
| 100 <param name="generate_report" value="true"/> | 131 <conditional name="report_format"> |
| 132 <param name="report_format_select" value="html"/> | |
| 133 <param name="output_format" value="side-by-side"/> | |
| 134 </conditional> | |
| 101 <output name="diff_file"> | 135 <output name="diff_file"> |
| 102 <assert_contents> | 136 <assert_contents> |
| 103 <has_n_lines n="0"/> | 137 <has_n_lines n="0"/> |
| 104 </assert_contents> | 138 </assert_contents> |
| 105 </output> | 139 </output> |
