changeset 0:8e251055b1a9 draft default tip

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/add_line_to_file commit 7947999ae57e82acc8e2c8de15248c2d69e59128"
author bgruening
date Sun, 01 Nov 2020 19:07:01 +0000
parents
children
files add_line_to_file.xml test-data/add_line.txt test-data/add_line_result1.txt test-data/add_line_result2.txt
diffstat 4 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/add_line_to_file.xml	Sun Nov 01 19:07:01 2020 +0000
@@ -0,0 +1,50 @@
+<tool id="add_line_to_file" name="Add line to file" version="0.1.0">
+    <description>writes a line of text at the begining or end of a text file.</description>
+    <requirements>
+        <requirement type="package" version="8.25">coreutils</requirement>
+    </requirements>
+    <command detect_errors="exit_code">
+    <![CDATA[
+        #if $options == 'header':
+            echo '$text_input' >> '$outfile' && cat '$infile' >> '$outfile'
+        #else
+            cat '$infile' >> '$outfile' && echo '$text_input' >> '$outfile'
+        #end if
+    ]]>
+    </command>
+    <inputs>
+        <param name="text_input" type="text" format="txt" label="text to add"/>
+        <param name="infile" type="data" format="txt" label="input file"/>
+        <param name="options" type="select" label="Options">
+            <option value="header" selected="True">header</option>
+            <option value="footer">footer</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="outfile" format_source="infile" metadata_source="infile"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="text_input" value="header"/>
+            <param name="infile" value="add_line.txt"/>
+            <param name="options" value="header"/>
+            <output name="outfile" file="add_line_result1.txt"/>
+        </test>
+        <test>
+            <param name="text_input" value="footer"/>
+            <param name="infile" value="add_line.txt"/>
+            <param name="options" value="footer"/>
+            <output name="outfile" file="add_line_result2.txt"/>
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+**What it does**
+
+This tool adds the input text to the beginning (header) or the end (footer) of the input text file.
+
+]]>
+    </help>
+    <citations>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/add_line.txt	Sun Nov 01 19:07:01 2020 +0000
@@ -0,0 +1,2 @@
+line 1
+line 2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/add_line_result1.txt	Sun Nov 01 19:07:01 2020 +0000
@@ -0,0 +1,3 @@
+header
+line 1
+line 2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/add_line_result2.txt	Sun Nov 01 19:07:01 2020 +0000
@@ -0,0 +1,3 @@
+line 1
+line 2
+footer