6
|
1 <tool id="tp_text_file_with_recurring_lines" name="Create text file" version="@BASE_VERSION@.0">
|
|
2 <description>with recurring lines</description>
|
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements" />
|
|
7 <version_command>yes --version | head -n 1</version_command>
|
|
8 <command>
|
|
9 <![CDATA[
|
|
10 #for $token in $token_set:
|
|
11 #if str($token.repeat_select.repeat_select_opts) == 'user':
|
|
12 times=#echo $token.repeat_select.times#;
|
|
13 #else:
|
|
14 times=`wc -l $token.repeat_select.infile | awk '{print $1}'`;
|
|
15 #end if
|
|
16 yes -- "${token.line}" 2>/dev/null | head -n \$times >> $outfile;
|
|
17 #end for
|
|
18 ]]>
|
|
19 </command>
|
|
20 <inputs>
|
|
21 <repeat name="token_set" title=" selection" min="1">
|
|
22 <param name="line" type="text" size="30"
|
|
23 label="Characters to insert" help="Specify the characters that will be inserted X times in every line"/>
|
|
24 <conditional name="repeat_select">
|
|
25 <param name="repeat_select_opts" type="select" label="Specify the number of iterations by">
|
|
26 <option value="file">File (for each line in file)</option>
|
|
27 <option value="user" selected="True">User defined number</option>
|
|
28 </param>
|
|
29 <when value="user">
|
|
30 <param name="times" size="10" type="integer" value="10" min="1" label="How many times?"/>
|
|
31 </when>
|
|
32 <when value="file">
|
|
33 <param name="infile" type="data" format="txt" label="Template file"
|
|
34 help="For every line, the specified characters will be written once. That means X is the line-number from the given file."/>
|
|
35 </when>
|
|
36 </conditional>
|
|
37 </repeat>
|
|
38 </inputs>
|
|
39 <outputs>
|
|
40 <data format="text" name="outfile"/>
|
|
41 </outputs>
|
|
42 <tests>
|
|
43 <test>
|
|
44 <repeat name="token_set">
|
|
45 <param name="line" value="freedom" />
|
|
46 <param name="repeat_select_opts" value="file" />
|
|
47 <param name="infile" value="multijoin2.txt" />
|
|
48 </repeat>
|
|
49 <output name="outfile" file="recurring_result1.txt" />
|
|
50 </test>
|
|
51 <test>
|
|
52 <repeat name="token_set">
|
|
53 <param name="line" value="freedom" />
|
|
54 <param name="repeat_select_opts" value="user" />
|
|
55 <param name="times" value="10" />
|
|
56 </repeat>
|
|
57 <repeat name="token_set">
|
|
58 <param name="line" value="war is over" />
|
|
59 <param name="repeat_select_opts" value="user" />
|
|
60 <param name="times" value="10" />
|
|
61 </repeat>
|
|
62 <output name="outfile" file="recurring_result2.txt" />
|
|
63 </test>
|
|
64 </tests>
|
|
65 <help>
|
|
66 <![CDATA[
|
|
67 .. class:: infomark
|
|
68
|
|
69 **What it does**
|
|
70
|
|
71 This tool creates a text file with recurring lines. You can specify a bunch of characters or entire sentences.
|
|
72 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.
|
|
73 In case the user provides a file, the line number will be used as X.
|
|
74
|
|
75 @REFERENCES@
|
|
76 ]]>
|
|
77 </help>
|
|
78 </tool>
|