changeset 0:0b3a28ad3947 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/dos2unix/ commit 7e66ed2b5a95d5d1523524e5dc106bd9d4cb6b43
author iuc
date Fri, 11 Jul 2025 11:20:26 +0000
parents
children
files dos2unix.xml macros.xml test-data/censored.txt test-data/censored_no_bom.txt test-data/info_censored_bom.txt test-data/info_censored_no_bom.txt
diffstat 6 files changed, 100 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dos2unix.xml	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,76 @@
+<tool id="dos2unix" name="Text file format converters (dos2unix)" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE_VERSION@">
+  <description>
+      Convert text files with DOS or Mac line breaks to Unix line breaks and other text cleaning options.
+    </description>
+  <macros>
+    <import>macros.xml</import>
+  </macros>
+  <edam_topics>
+    <edam_topic>topic_3572</edam_topic>
+  </edam_topics>
+  <edam_operations>
+    <edam_operation>operation_0335</edam_operation>
+  </edam_operations>
+  <expand macro="requirements"/>
+  <command detect_errors="exit_code"><![CDATA[
+    #if $info
+      dos2unix --info $mac_mode '$input_file' > '$output_file'
+    #else
+      dos2unix --newfile --safe $add_end_of_line $mac_mode $bom '$input_file' '$output_file'
+    #end if
+    ]]></command>
+  <inputs>
+    <param name="input_file" format="txt,tsv,csv,tabular" type="data" label="The input file to convert to Unix format"/>
+    <param name="add_end_of_line" type="boolean" truevalue="--add-eol" falsevalue="--no-add-eol" checked="true" label="Add (or don't add) a line break to the last line if there isn't one."/>
+    <param name="bom" type="boolean" truevalue="--remove-bom" falsevalue="--keep-bom" checked="true" label="Remove Byte Order Mark (BOM). Do not write a BOM in the output file."/>
+    <param name="mac_mode" type="boolean" truevalue="-c mac" falsevalue="" checked="false" label="Run in Mac Mode." help="By default line breaks are converted from DOS to Unix and vice versa. Mac line breaks are not converted. In Mac mode line breaks are converted from Mac to Unix and vice versa. DOS line breaks are not changed."/>
+    <param name="info" type="boolean" truevalue="--info" falsevalue="" checked="false" label="Display file information. No conversion is done." help="The following information is printed, in this order: number of DOS line breaks, number of Unix line breaks, number of Mac line breaks, byte order mark, text or binary, file name."/>
+  </inputs>
+  <outputs>
+    <data name="output_file" format="txt"/>
+  </outputs>
+  <tests>
+    <test expect_num_outputs="1">
+      <param name="input_file" value="censored.txt"/>
+      <param name="add_end_of_line" value="false"/>
+      <param name="bom" value="false"/>
+      <param name="mac_mode" value="false"/>
+      <param name="info" value="true"/>
+      <output name="output_file">
+        <assert_contents>
+          <has_text text="UTF-8"/>
+        </assert_contents>
+      </output>
+    </test>
+    <test expect_num_outputs="1">
+      <param name="input_file" value="censored_no_bom.txt"/>
+      <param name="add_end_of_line" value="false"/>
+      <param name="bom" value="false"/>
+      <param name="mac_mode" value="false"/>
+      <param name="info" value="true"/>
+      <output name="output_file">
+        <assert_contents>
+          <has_text text="no_bom"/>
+        </assert_contents>
+      </output>
+    </test>
+    <test expect_num_outputs="1">
+      <param name="input_file" value="censored.txt"/>
+      <param name="add_end_of_line" value="true"/>
+      <param name="bom" value="true"/>
+      <param name="mac_mode" value="false"/>
+      <param name="info" value="false"/>
+      <output name="output_file" file="censored_no_bom.txt"/>
+    </test>
+  </tests>
+  <help><![CDATA[
+    This tool can be used to convert files in DOS or Mac format to Unix format.
+    In DOS/Windows text files a line break, also known as newline, is a combination of two
+    characters: a Carriage Return (CR) followed by a Line Feed (LF). In Unix text files a
+    line break is a single character: the Line Feed (LF). In Mac text files, prior to Mac OS X,
+    a line break was single Carriage Return (CR) character. Nowadays Mac OS uses Unix style (LF) line breaks.
+    ]]></help>
+  <citations>
+    <expand macro="citations"/>
+  </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,18 @@
+<macros>
+    <token name="@TOOL_VERSION@">7.5.2</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@PROFILE_VERSION@">23.2</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">dos2unix</requirement>
+        </requirements>
+    </xml>
+    <xml name="citations">
+        <citation type="bibtex">@UNPUBLISHED{Waterlander2025,
+            author = "Erwin Waterlander"
+            title = "Dos2Unix / Unix2Dos - Text file format converters"
+            year = "2025"
+            note = "https://sourceforge.net/projects/dos2unix/"}
+        </citation>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/censored.txt	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,2 @@
+本
+紙
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/censored_no_bom.txt	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,2 @@
+本
+紙
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/info_censored_bom.txt	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,1 @@
+       0       1       0  UTF-8     text    test-data/censored.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/info_censored_no_bom.txt	Fri Jul 11 11:20:26 2025 +0000
@@ -0,0 +1,1 @@
+       0       1       0  no_bom    text    test-data/censored_no_bom.txt