Mercurial > repos > bgruening > text_processing
diff recurring_lines.xml @ 6:8928e6d1e7ba draft
Uploaded
author | bgruening |
---|---|
date | Thu, 08 Jan 2015 09:07:31 -0500 |
parents | |
children | d64eace4f9f3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/recurring_lines.xml Thu Jan 08 09:07:31 2015 -0500 @@ -0,0 +1,78 @@ +<tool id="tp_text_file_with_recurring_lines" name="Create text file" version="@BASE_VERSION@.0"> + <description>with recurring lines</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="requirements" /> + <version_command>yes --version | head -n 1</version_command> + <command> +<![CDATA[ + #for $token in $token_set: + #if str($token.repeat_select.repeat_select_opts) == 'user': + times=#echo $token.repeat_select.times#; + #else: + times=`wc -l $token.repeat_select.infile | awk '{print $1}'`; + #end if + yes -- "${token.line}" 2>/dev/null | head -n \$times >> $outfile; + #end for +]]> + </command> + <inputs> + <repeat name="token_set" title=" selection" min="1"> + <param name="line" type="text" size="30" + label="Characters to insert" help="Specify the characters that will be inserted X times in every line"/> + <conditional name="repeat_select"> + <param name="repeat_select_opts" type="select" label="Specify the number of iterations by"> + <option value="file">File (for each line in file)</option> + <option value="user" selected="True">User defined number</option> + </param> + <when value="user"> + <param name="times" size="10" type="integer" value="10" min="1" label="How many times?"/> + </when> + <when value="file"> + <param name="infile" type="data" format="txt" label="Template file" + help="For every line, the specified characters will be written once. That means X is the line-number from the given file."/> + </when> + </conditional> + </repeat> + </inputs> + <outputs> + <data format="text" name="outfile"/> + </outputs> + <tests> + <test> + <repeat name="token_set"> + <param name="line" value="freedom" /> + <param name="repeat_select_opts" value="file" /> + <param name="infile" value="multijoin2.txt" /> + </repeat> + <output name="outfile" file="recurring_result1.txt" /> + </test> + <test> + <repeat name="token_set"> + <param name="line" value="freedom" /> + <param name="repeat_select_opts" value="user" /> + <param name="times" value="10" /> + </repeat> + <repeat name="token_set"> + <param name="line" value="war is over" /> + <param name="repeat_select_opts" value="user" /> + <param name="times" value="10" /> + </repeat> + <output name="outfile" file="recurring_result2.txt" /> + </test> + </tests> + <help> +<![CDATA[ +.. class:: infomark + +**What it does** + +This tool creates a text file with recurring lines. You can specify a bunch of characters or entire sentences. +The entire string will be printed X times separated by a line break. X can be either given by the use as a number or calculated by a given file. +In case the user provides a file, the line number will be used as X. + +@REFERENCES@ +]]> + </help> +</tool>